#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
#[doc = r" Value to write to the register"]
pub struct W {
bits: u32,
}
impl super::GLOBRESD {
#[doc = r" Modifies the contents of the register"]
#[inline]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
let r = R { bits: bits };
let mut w = W { bits: bits };
f(&r, &mut w);
self.register.set(w.bits);
}
#[doc = r" Reads the contents of the register"]
#[inline]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
#[doc = r" Writes to the register"]
#[inline]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
let mut w = W::reset_value();
f(&mut w);
self.register.set(w.bits);
}
#[doc = r" Writes the reset value to the register"]
#[inline]
pub fn reset(&self) {
self.write(|w| w)
}
}
#[doc = r" Value of the field"]
pub struct RESULTR {
bits: u16,
}
impl RESULTR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u16 {
self.bits
}
}
#[doc = r" Value of the field"]
pub struct GNRR {
bits: u8,
}
impl GNRR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Value of the field"]
pub struct CHNRR {
bits: u8,
}
impl CHNRR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Value of the field"]
pub struct EMUXR {
bits: u8,
}
impl EMUXR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Value of the field"]
pub struct CRSR {
bits: u8,
}
impl CRSR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = "Possible values of the field `FCR`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FCRR {
#[doc = "Signal level was below compare value"]
VALUE1,
#[doc = "Signal level was above compare value"]
VALUE2,
}
impl FCRR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
FCRR::VALUE1 => false,
FCRR::VALUE2 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> FCRR {
match value {
false => FCRR::VALUE1,
true => FCRR::VALUE2,
}
}
#[doc = "Checks if the value of the field is `VALUE1`"]
#[inline]
pub fn is_value1(&self) -> bool {
*self == FCRR::VALUE1
}
#[doc = "Checks if the value of the field is `VALUE2`"]
#[inline]
pub fn is_value2(&self) -> bool {
*self == FCRR::VALUE2
}
}
#[doc = "Possible values of the field `VF`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum VFR {
#[doc = "Read access: No new valid data available Write access: No effect"]
VALUE1,
#[doc = "Read access: Bitfield RESULT contains valid data and has not yet been read, or bit FCR has been updated Write access: Clear this valid flag and the data reduction counter (overrides a hardware set action)"]
VALUE2,
}
impl VFR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
VFR::VALUE1 => false,
VFR::VALUE2 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> VFR {
match value {
false => VFR::VALUE1,
true => VFR::VALUE2,
}
}
#[doc = "Checks if the value of the field is `VALUE1`"]
#[inline]
pub fn is_value1(&self) -> bool {
*self == VFR::VALUE1
}
#[doc = "Checks if the value of the field is `VALUE2`"]
#[inline]
pub fn is_value2(&self) -> bool {
*self == VFR::VALUE2
}
}
#[doc = r" Proxy"]
pub struct _RESULTW<'a> {
w: &'a mut W,
}
impl<'a> _RESULTW<'a> {
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u16) -> &'a mut W {
const MASK: u16 = 65535;
const OFFSET: u8 = 0;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
#[doc = "Values that can be written to the field `VF`"]
pub enum VFW {
#[doc = "Read access: No new valid data available Write access: No effect"]
VALUE1,
#[doc = "Read access: Bitfield RESULT contains valid data and has not yet been read, or bit FCR has been updated Write access: Clear this valid flag and the data reduction counter (overrides a hardware set action)"]
VALUE2,
}
impl VFW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
VFW::VALUE1 => false,
VFW::VALUE2 => true,
}
}
}
#[doc = r" Proxy"]
pub struct _VFW<'a> {
w: &'a mut W,
}
impl<'a> _VFW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: VFW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Read access: No new valid data available Write access: No effect"]
#[inline]
pub fn value1(self) -> &'a mut W {
self.variant(VFW::VALUE1)
}
#[doc = "Read access: Bitfield RESULT contains valid data and has not yet been read, or bit FCR has been updated Write access: Clear this valid flag and the data reduction counter (overrides a hardware set action)"]
#[inline]
pub fn value2(self) -> &'a mut W {
self.variant(VFW::VALUE2)
}
#[doc = r" Sets the field bit"]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r" Clears the field bit"]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r" Writes raw bits to the field"]
#[inline]
pub fn bit(self, value: bool) -> &'a mut W {
const MASK: bool = true;
const OFFSET: u8 = 31;
self.w.bits &= !((MASK as u32) << OFFSET);
self.w.bits |= ((value & MASK) as u32) << OFFSET;
self.w
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bits 0:15 - Result of most recent conversion"]
#[inline]
pub fn result(&self) -> RESULTR {
let bits = {
const MASK: u16 = 65535;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) as u16
};
RESULTR { bits }
}
#[doc = "Bits 16:19 - Group Number"]
#[inline]
pub fn gnr(&self) -> GNRR {
let bits = {
const MASK: u8 = 15;
const OFFSET: u8 = 16;
((self.bits >> OFFSET) & MASK as u32) as u8
};
GNRR { bits }
}
#[doc = "Bits 20:24 - Channel Number"]
#[inline]
pub fn chnr(&self) -> CHNRR {
let bits = {
const MASK: u8 = 31;
const OFFSET: u8 = 20;
((self.bits >> OFFSET) & MASK as u32) as u8
};
CHNRR { bits }
}
#[doc = "Bits 25:27 - External Multiplexer Setting"]
#[inline]
pub fn emux(&self) -> EMUXR {
let bits = {
const MASK: u8 = 7;
const OFFSET: u8 = 25;
((self.bits >> OFFSET) & MASK as u32) as u8
};
EMUXR { bits }
}
#[doc = "Bits 28:29 - Converted Request Source"]
#[inline]
pub fn crs(&self) -> CRSR {
let bits = {
const MASK: u8 = 3;
const OFFSET: u8 = 28;
((self.bits >> OFFSET) & MASK as u32) as u8
};
CRSR { bits }
}
#[doc = "Bit 30 - Fast Compare Result"]
#[inline]
pub fn fcr(&self) -> FCRR {
FCRR::_from({
const MASK: bool = true;
const OFFSET: u8 = 30;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 31 - Valid Flag"]
#[inline]
pub fn vf(&self) -> VFR {
VFR::_from({
const MASK: bool = true;
const OFFSET: u8 = 31;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
}
impl W {
#[doc = r" Reset value of the register"]
#[inline]
pub fn reset_value() -> W {
W { bits: 0 }
}
#[doc = r" Writes raw bits to the register"]
#[inline]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bits 0:15 - Result of most recent conversion"]
#[inline]
pub fn result(&mut self) -> _RESULTW {
_RESULTW { w: self }
}
#[doc = "Bit 31 - Valid Flag"]
#[inline]
pub fn vf(&mut self) -> _VFW {
_VFW { w: self }
}
}