#[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::MCR {
#[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 RESERVED6R {
bits: u32,
}
impl RESERVED6R {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
}
#[doc = "Possible values of the field `SFE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SFER {
#[doc = "Slave mode is enabled."]
EN,
#[doc = "Slave mode is disabled."]
DIS,
}
impl SFER {
#[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 {
SFER::EN => true,
SFER::DIS => false,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> SFER {
match value {
true => SFER::EN,
false => SFER::DIS,
}
}
#[doc = "Checks if the value of the field is `EN`"]
#[inline]
pub fn is_en(&self) -> bool {
*self == SFER::EN
}
#[doc = "Checks if the value of the field is `DIS`"]
#[inline]
pub fn is_dis(&self) -> bool {
*self == SFER::DIS
}
}
#[doc = "Possible values of the field `MFE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum MFER {
#[doc = "Master mode is enabled."]
EN,
#[doc = "Master mode is disabled."]
DIS,
}
impl MFER {
#[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 {
MFER::EN => true,
MFER::DIS => false,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> MFER {
match value {
true => MFER::EN,
false => MFER::DIS,
}
}
#[doc = "Checks if the value of the field is `EN`"]
#[inline]
pub fn is_en(&self) -> bool {
*self == MFER::EN
}
#[doc = "Checks if the value of the field is `DIS`"]
#[inline]
pub fn is_dis(&self) -> bool {
*self == MFER::DIS
}
}
#[doc = r" Value of the field"]
pub struct RESERVED1R {
bits: u8,
}
impl RESERVED1R {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = "Possible values of the field `LPBK`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LPBKR {
#[doc = "Enable Test Mode"]
EN,
#[doc = "Disable Test Mode"]
DIS,
}
impl LPBKR {
#[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 {
LPBKR::EN => true,
LPBKR::DIS => false,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> LPBKR {
match value {
true => LPBKR::EN,
false => LPBKR::DIS,
}
}
#[doc = "Checks if the value of the field is `EN`"]
#[inline]
pub fn is_en(&self) -> bool {
*self == LPBKR::EN
}
#[doc = "Checks if the value of the field is `DIS`"]
#[inline]
pub fn is_dis(&self) -> bool {
*self == LPBKR::DIS
}
}
#[doc = r" Proxy"]
pub struct _RESERVED6W<'a> {
w: &'a mut W,
}
impl<'a> _RESERVED6W<'a> {
#[doc = r" Writes raw bits to the field"]
#[inline]
pub unsafe fn bits(self, value: u32) -> &'a mut W {
const MASK: u32 = 67108863;
const OFFSET: u8 = 6;
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 `SFE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SFEW {
#[doc = "Slave mode is enabled."]
EN,
#[doc = "Slave mode is disabled."]
DIS,
}
impl SFEW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
SFEW::EN => true,
SFEW::DIS => false,
}
}
}
#[doc = r" Proxy"]
pub struct _SFEW<'a> {
w: &'a mut W,
}
impl<'a> _SFEW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: SFEW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Slave mode is enabled."]
#[inline]
pub fn en(self) -> &'a mut W {
self.variant(SFEW::EN)
}
#[doc = "Slave mode is disabled."]
#[inline]
pub fn dis(self) -> &'a mut W {
self.variant(SFEW::DIS)
}
#[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 = 5;
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 `MFE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum MFEW {
#[doc = "Master mode is enabled."]
EN,
#[doc = "Master mode is disabled."]
DIS,
}
impl MFEW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
MFEW::EN => true,
MFEW::DIS => false,
}
}
}
#[doc = r" Proxy"]
pub struct _MFEW<'a> {
w: &'a mut W,
}
impl<'a> _MFEW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: MFEW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Master mode is enabled."]
#[inline]
pub fn en(self) -> &'a mut W {
self.variant(MFEW::EN)
}
#[doc = "Master mode is disabled."]
#[inline]
pub fn dis(self) -> &'a mut W {
self.variant(MFEW::DIS)
}
#[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 = 4;
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 `LPBK`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LPBKW {
#[doc = "Enable Test Mode"]
EN,
#[doc = "Disable Test Mode"]
DIS,
}
impl LPBKW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _bits(&self) -> bool {
match *self {
LPBKW::EN => true,
LPBKW::DIS => false,
}
}
}
#[doc = r" Proxy"]
pub struct _LPBKW<'a> {
w: &'a mut W,
}
impl<'a> _LPBKW<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline]
pub fn variant(self, variant: LPBKW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "Enable Test Mode"]
#[inline]
pub fn en(self) -> &'a mut W {
self.variant(LPBKW::EN)
}
#[doc = "Disable Test Mode"]
#[inline]
pub fn dis(self) -> &'a mut W {
self.variant(LPBKW::DIS)
}
#[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 = 0;
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 6:31 - Software should not rely on the value of a reserved. Writing any other value than the reset value may result in undefined behavior."]
#[inline]
pub fn reserved6(&self) -> RESERVED6R {
let bits = {
const MASK: u32 = 67108863;
const OFFSET: u8 = 6;
((self.bits >> OFFSET) & MASK as u32) as u32
};
RESERVED6R { bits }
}
#[doc = "Bit 5 - I2C slave function enable"]
#[inline]
pub fn sfe(&self) -> SFER {
SFER::_from({
const MASK: bool = true;
const OFFSET: u8 = 5;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bit 4 - I2C master function enable"]
#[inline]
pub fn mfe(&self) -> MFER {
MFER::_from({
const MASK: bool = true;
const OFFSET: u8 = 4;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bits 1:3 - Software should not rely on the value of a reserved. Writing any other value than the reset value may result in undefined behavior."]
#[inline]
pub fn reserved1(&self) -> RESERVED1R {
let bits = {
const MASK: u8 = 7;
const OFFSET: u8 = 1;
((self.bits >> OFFSET) & MASK as u32) as u8
};
RESERVED1R { bits }
}
#[doc = "Bit 0 - I2C loopback 0: Normal operation 1: Loopback operation (test mode)"]
#[inline]
pub fn lpbk(&self) -> LPBKR {
LPBKR::_from({
const MASK: bool = true;
const OFFSET: u8 = 0;
((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 6:31 - Software should not rely on the value of a reserved. Writing any other value than the reset value may result in undefined behavior."]
#[inline]
pub fn reserved6(&mut self) -> _RESERVED6W {
_RESERVED6W { w: self }
}
#[doc = "Bit 5 - I2C slave function enable"]
#[inline]
pub fn sfe(&mut self) -> _SFEW {
_SFEW { w: self }
}
#[doc = "Bit 4 - I2C master function enable"]
#[inline]
pub fn mfe(&mut self) -> _MFEW {
_MFEW { w: self }
}
#[doc = "Bit 0 - I2C loopback 0: Normal operation 1: Loopback operation (test mode)"]
#[inline]
pub fn lpbk(&mut self) -> _LPBKW {
_LPBKW { w: self }
}
}