#[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::ISR {
#[doc = r"Modifies the contents of the register"]
#[inline(always)]
pub fn modify<F>(&self, f: F)
where
for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
{
let bits = self.register.get();
self.register.set(f(&R { bits }, &mut W { bits }).bits);
}
#[doc = r"Reads the contents of the register"]
#[inline(always)]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
#[doc = r"Writes to the register"]
#[inline(always)]
pub fn write<F>(&self, f: F)
where
F: FnOnce(&mut W) -> &mut W,
{
self.register.set(
f(&mut W {
bits: Self::reset_value(),
})
.bits,
);
}
#[doc = r"Reset value of the register"]
#[inline(always)]
pub const fn reset_value() -> u32 {
0x01
}
#[doc = r"Writes the reset value to the register"]
#[inline(always)]
pub fn reset(&self) {
self.register.set(Self::reset_value())
}
}
#[doc = r"Value of the field"]
pub struct ADDCODER {
bits: u8,
}
impl ADDCODER {
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = "Possible values of the field `DIR`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DIRR {
#[doc = "Write transfer, slave enters receiver mode"]
WRITE,
#[doc = "Read transfer, slave enters transmitter mode"]
READ,
}
impl DIRR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
DIRR::WRITE => false,
DIRR::READ => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> DIRR {
match value {
false => DIRR::WRITE,
true => DIRR::READ,
}
}
#[doc = "Checks if the value of the field is `WRITE`"]
#[inline(always)]
pub fn is_write(&self) -> bool {
*self == DIRR::WRITE
}
#[doc = "Checks if the value of the field is `READ`"]
#[inline(always)]
pub fn is_read(&self) -> bool {
*self == DIRR::READ
}
}
#[doc = "Possible values of the field `BUSY`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BUSYR {
#[doc = "No communication is in progress on the bus"]
NOTBUSY,
#[doc = "A communication is in progress on the bus"]
BUSY,
}
impl BUSYR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
BUSYR::NOTBUSY => false,
BUSYR::BUSY => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> BUSYR {
match value {
false => BUSYR::NOTBUSY,
true => BUSYR::BUSY,
}
}
#[doc = "Checks if the value of the field is `NOTBUSY`"]
#[inline(always)]
pub fn is_not_busy(&self) -> bool {
*self == BUSYR::NOTBUSY
}
#[doc = "Checks if the value of the field is `BUSY`"]
#[inline(always)]
pub fn is_busy(&self) -> bool {
*self == BUSYR::BUSY
}
}
#[doc = "Possible values of the field `ALERT`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ALERTR {
#[doc = "SMBA alert is not detected"]
NOALERT,
#[doc = "SMBA alert event is detected on SMBA pin"]
ALERT,
}
impl ALERTR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
ALERTR::NOALERT => false,
ALERTR::ALERT => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> ALERTR {
match value {
false => ALERTR::NOALERT,
true => ALERTR::ALERT,
}
}
#[doc = "Checks if the value of the field is `NOALERT`"]
#[inline(always)]
pub fn is_no_alert(&self) -> bool {
*self == ALERTR::NOALERT
}
#[doc = "Checks if the value of the field is `ALERT`"]
#[inline(always)]
pub fn is_alert(&self) -> bool {
*self == ALERTR::ALERT
}
}
#[doc = "Possible values of the field `TIMEOUT`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TIMEOUTR {
#[doc = "No timeout occured"]
NOTIMEOUT,
#[doc = "Timeout occured"]
TIMEOUT,
}
impl TIMEOUTR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
TIMEOUTR::NOTIMEOUT => false,
TIMEOUTR::TIMEOUT => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> TIMEOUTR {
match value {
false => TIMEOUTR::NOTIMEOUT,
true => TIMEOUTR::TIMEOUT,
}
}
#[doc = "Checks if the value of the field is `NOTIMEOUT`"]
#[inline(always)]
pub fn is_no_timeout(&self) -> bool {
*self == TIMEOUTR::NOTIMEOUT
}
#[doc = "Checks if the value of the field is `TIMEOUT`"]
#[inline(always)]
pub fn is_timeout(&self) -> bool {
*self == TIMEOUTR::TIMEOUT
}
}
#[doc = "Possible values of the field `PECERR`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PECERRR {
#[doc = "Received PEC does match with PEC register"]
MATCH,
#[doc = "Received PEC does not match with PEC register"]
NOMATCH,
}
impl PECERRR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
PECERRR::MATCH => false,
PECERRR::NOMATCH => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> PECERRR {
match value {
false => PECERRR::MATCH,
true => PECERRR::NOMATCH,
}
}
#[doc = "Checks if the value of the field is `MATCH`"]
#[inline(always)]
pub fn is_match_(&self) -> bool {
*self == PECERRR::MATCH
}
#[doc = "Checks if the value of the field is `NOMATCH`"]
#[inline(always)]
pub fn is_no_match(&self) -> bool {
*self == PECERRR::NOMATCH
}
}
#[doc = "Possible values of the field `OVR`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OVRR {
#[doc = "No overrun/underrun error occurs"]
NOOVERRUN,
#[doc = "slave mode with NOSTRETCH=1, when an overrun/underrun error occurs"]
OVERRUN,
}
impl OVRR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
OVRR::NOOVERRUN => false,
OVRR::OVERRUN => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> OVRR {
match value {
false => OVRR::NOOVERRUN,
true => OVRR::OVERRUN,
}
}
#[doc = "Checks if the value of the field is `NOOVERRUN`"]
#[inline(always)]
pub fn is_no_overrun(&self) -> bool {
*self == OVRR::NOOVERRUN
}
#[doc = "Checks if the value of the field is `OVERRUN`"]
#[inline(always)]
pub fn is_overrun(&self) -> bool {
*self == OVRR::OVERRUN
}
}
#[doc = "Possible values of the field `ARLO`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ARLOR {
#[doc = "No arbitration lost"]
NOTLOST,
#[doc = "Arbitration lost"]
LOST,
}
impl ARLOR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
ARLOR::NOTLOST => false,
ARLOR::LOST => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> ARLOR {
match value {
false => ARLOR::NOTLOST,
true => ARLOR::LOST,
}
}
#[doc = "Checks if the value of the field is `NOTLOST`"]
#[inline(always)]
pub fn is_not_lost(&self) -> bool {
*self == ARLOR::NOTLOST
}
#[doc = "Checks if the value of the field is `LOST`"]
#[inline(always)]
pub fn is_lost(&self) -> bool {
*self == ARLOR::LOST
}
}
#[doc = "Possible values of the field `BERR`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BERRR {
#[doc = "No bus error"]
NOERROR,
#[doc = "Misplaced Start and Stop condition is detected"]
ERROR,
}
impl BERRR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
BERRR::NOERROR => false,
BERRR::ERROR => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> BERRR {
match value {
false => BERRR::NOERROR,
true => BERRR::ERROR,
}
}
#[doc = "Checks if the value of the field is `NOERROR`"]
#[inline(always)]
pub fn is_no_error(&self) -> bool {
*self == BERRR::NOERROR
}
#[doc = "Checks if the value of the field is `ERROR`"]
#[inline(always)]
pub fn is_error(&self) -> bool {
*self == BERRR::ERROR
}
}
#[doc = "Possible values of the field `TCR`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TCRR {
#[doc = "Transfer is not complete"]
NOTCOMPLETE,
#[doc = "NBYTES has been transfered"]
COMPLETE,
}
impl TCRR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
TCRR::NOTCOMPLETE => false,
TCRR::COMPLETE => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> TCRR {
match value {
false => TCRR::NOTCOMPLETE,
true => TCRR::COMPLETE,
}
}
#[doc = "Checks if the value of the field is `NOTCOMPLETE`"]
#[inline(always)]
pub fn is_not_complete(&self) -> bool {
*self == TCRR::NOTCOMPLETE
}
#[doc = "Checks if the value of the field is `COMPLETE`"]
#[inline(always)]
pub fn is_complete(&self) -> bool {
*self == TCRR::COMPLETE
}
}
#[doc = "Possible values of the field `TC`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TCR {
#[doc = "Transfer is not complete"]
NOTCOMPLETE,
#[doc = "NBYTES has been transfered"]
COMPLETE,
}
impl TCR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
TCR::NOTCOMPLETE => false,
TCR::COMPLETE => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> TCR {
match value {
false => TCR::NOTCOMPLETE,
true => TCR::COMPLETE,
}
}
#[doc = "Checks if the value of the field is `NOTCOMPLETE`"]
#[inline(always)]
pub fn is_not_complete(&self) -> bool {
*self == TCR::NOTCOMPLETE
}
#[doc = "Checks if the value of the field is `COMPLETE`"]
#[inline(always)]
pub fn is_complete(&self) -> bool {
*self == TCR::COMPLETE
}
}
#[doc = "Possible values of the field `STOPF`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum STOPFR {
#[doc = "No Stop condition detected"]
NOSTOP,
#[doc = "Stop condition detected"]
STOP,
}
impl STOPFR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
STOPFR::NOSTOP => false,
STOPFR::STOP => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> STOPFR {
match value {
false => STOPFR::NOSTOP,
true => STOPFR::STOP,
}
}
#[doc = "Checks if the value of the field is `NOSTOP`"]
#[inline(always)]
pub fn is_no_stop(&self) -> bool {
*self == STOPFR::NOSTOP
}
#[doc = "Checks if the value of the field is `STOP`"]
#[inline(always)]
pub fn is_stop(&self) -> bool {
*self == STOPFR::STOP
}
}
#[doc = "Possible values of the field `NACKF`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum NACKFR {
#[doc = "No NACK has been received"]
NONACK,
#[doc = "NACK has been received"]
NACK,
}
impl NACKFR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
NACKFR::NONACK => false,
NACKFR::NACK => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> NACKFR {
match value {
false => NACKFR::NONACK,
true => NACKFR::NACK,
}
}
#[doc = "Checks if the value of the field is `NONACK`"]
#[inline(always)]
pub fn is_no_nack(&self) -> bool {
*self == NACKFR::NONACK
}
#[doc = "Checks if the value of the field is `NACK`"]
#[inline(always)]
pub fn is_nack(&self) -> bool {
*self == NACKFR::NACK
}
}
#[doc = "Possible values of the field `ADDR`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADDRR {
#[doc = "Adress mismatched or not received"]
NOTMATCH,
#[doc = "Received slave address matched with one of the enabled slave addresses"]
MATCH,
}
impl ADDRR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
ADDRR::NOTMATCH => false,
ADDRR::MATCH => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> ADDRR {
match value {
false => ADDRR::NOTMATCH,
true => ADDRR::MATCH,
}
}
#[doc = "Checks if the value of the field is `NOTMATCH`"]
#[inline(always)]
pub fn is_not_match(&self) -> bool {
*self == ADDRR::NOTMATCH
}
#[doc = "Checks if the value of the field is `MATCH`"]
#[inline(always)]
pub fn is_match_(&self) -> bool {
*self == ADDRR::MATCH
}
}
#[doc = "Possible values of the field `RXNE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RXNER {
#[doc = "The RXDR register is empty"]
EMPTY,
#[doc = "Received data is copied into the RXDR register, and is ready to be read"]
NOTEMPTY,
}
impl RXNER {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
RXNER::EMPTY => false,
RXNER::NOTEMPTY => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> RXNER {
match value {
false => RXNER::EMPTY,
true => RXNER::NOTEMPTY,
}
}
#[doc = "Checks if the value of the field is `EMPTY`"]
#[inline(always)]
pub fn is_empty(&self) -> bool {
*self == RXNER::EMPTY
}
#[doc = "Checks if the value of the field is `NOTEMPTY`"]
#[inline(always)]
pub fn is_not_empty(&self) -> bool {
*self == RXNER::NOTEMPTY
}
}
#[doc = "Possible values of the field `TXIS`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TXISR {
#[doc = "The TXDR register is not empty"]
NOTEMPTY,
#[doc = "The TXDR register is empty and the data to be transmitted must be written in the TXDR register"]
EMPTY,
}
impl TXISR {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
TXISR::NOTEMPTY => false,
TXISR::EMPTY => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> TXISR {
match value {
false => TXISR::NOTEMPTY,
true => TXISR::EMPTY,
}
}
#[doc = "Checks if the value of the field is `NOTEMPTY`"]
#[inline(always)]
pub fn is_not_empty(&self) -> bool {
*self == TXISR::NOTEMPTY
}
#[doc = "Checks if the value of the field is `EMPTY`"]
#[inline(always)]
pub fn is_empty(&self) -> bool {
*self == TXISR::EMPTY
}
}
#[doc = "Values that can be written to the field `TXIS`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TXISW {
#[doc = "The TXDR register is not empty"]
NOTEMPTY,
#[doc = "The TXDR register is empty and the data to be transmitted must be written in the TXDR register"]
EMPTY,
}
impl TXISW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
TXISW::NOTEMPTY => false,
TXISW::EMPTY => true,
}
}
}
#[doc = r"Proxy"]
pub struct _TXISW<'a> {
w: &'a mut W,
}
impl<'a> _TXISW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TXISW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "The TXDR register is not empty"]
#[inline(always)]
pub fn not_empty(self) -> &'a mut W {
self.variant(TXISW::NOTEMPTY)
}
#[doc = "The TXDR register is empty and the data to be transmitted must be written in the TXDR register"]
#[inline(always)]
pub fn empty(self) -> &'a mut W {
self.variant(TXISW::EMPTY)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(0x01 << 1);
self.w.bits |= ((value as u32) & 0x01) << 1;
self.w
}
}
#[doc = "Possible values of the field `TXE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TXER {
#[doc = "TXDR register not empty"]
NOTEMPTY,
#[doc = "TXDR register empty"]
EMPTY,
}
impl TXER {
#[doc = r"Returns `true` if the bit is clear (0)"]
#[inline(always)]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r"Returns `true` if the bit is set (1)"]
#[inline(always)]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r"Value of the field as raw bits"]
#[inline(always)]
pub fn bit(&self) -> bool {
match *self {
TXER::NOTEMPTY => false,
TXER::EMPTY => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _from(value: bool) -> TXER {
match value {
false => TXER::NOTEMPTY,
true => TXER::EMPTY,
}
}
#[doc = "Checks if the value of the field is `NOTEMPTY`"]
#[inline(always)]
pub fn is_not_empty(&self) -> bool {
*self == TXER::NOTEMPTY
}
#[doc = "Checks if the value of the field is `EMPTY`"]
#[inline(always)]
pub fn is_empty(&self) -> bool {
*self == TXER::EMPTY
}
}
#[doc = "Values that can be written to the field `TXE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TXEW {
#[doc = "TXDR register not empty"]
NOTEMPTY,
#[doc = "TXDR register empty"]
EMPTY,
}
impl TXEW {
#[allow(missing_docs)]
#[doc(hidden)]
#[inline(always)]
pub fn _bits(&self) -> bool {
match *self {
TXEW::NOTEMPTY => false,
TXEW::EMPTY => true,
}
}
}
#[doc = r"Proxy"]
pub struct _TXEW<'a> {
w: &'a mut W,
}
impl<'a> _TXEW<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TXEW) -> &'a mut W {
{
self.bit(variant._bits())
}
}
#[doc = "TXDR register not empty"]
#[inline(always)]
pub fn not_empty(self) -> &'a mut W {
self.variant(TXEW::NOTEMPTY)
}
#[doc = "TXDR register empty"]
#[inline(always)]
pub fn empty(self) -> &'a mut W {
self.variant(TXEW::EMPTY)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits &= !(0x01 << 0);
self.w.bits |= ((value as u32) & 0x01) << 0;
self.w
}
}
impl R {
#[doc = r"Value of the register as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bits 17:23 - Address match code (Slave mode)"]
#[inline(always)]
pub fn addcode(&self) -> ADDCODER {
let bits = ((self.bits >> 17) & 0x7f) as u8;
ADDCODER { bits }
}
#[doc = "Bit 16 - Transfer direction (Slave mode)"]
#[inline(always)]
pub fn dir(&self) -> DIRR {
DIRR::_from(((self.bits >> 16) & 0x01) != 0)
}
#[doc = "Bit 15 - Bus busy"]
#[inline(always)]
pub fn busy(&self) -> BUSYR {
BUSYR::_from(((self.bits >> 15) & 0x01) != 0)
}
#[doc = "Bit 13 - SMBus alert"]
#[inline(always)]
pub fn alert(&self) -> ALERTR {
ALERTR::_from(((self.bits >> 13) & 0x01) != 0)
}
#[doc = "Bit 12 - Timeout or t_low detection flag"]
#[inline(always)]
pub fn timeout(&self) -> TIMEOUTR {
TIMEOUTR::_from(((self.bits >> 12) & 0x01) != 0)
}
#[doc = "Bit 11 - PEC Error in reception"]
#[inline(always)]
pub fn pecerr(&self) -> PECERRR {
PECERRR::_from(((self.bits >> 11) & 0x01) != 0)
}
#[doc = "Bit 10 - Overrun/Underrun (slave mode)"]
#[inline(always)]
pub fn ovr(&self) -> OVRR {
OVRR::_from(((self.bits >> 10) & 0x01) != 0)
}
#[doc = "Bit 9 - Arbitration lost"]
#[inline(always)]
pub fn arlo(&self) -> ARLOR {
ARLOR::_from(((self.bits >> 9) & 0x01) != 0)
}
#[doc = "Bit 8 - Bus error"]
#[inline(always)]
pub fn berr(&self) -> BERRR {
BERRR::_from(((self.bits >> 8) & 0x01) != 0)
}
#[doc = "Bit 7 - Transfer Complete Reload"]
#[inline(always)]
pub fn tcr(&self) -> TCRR {
TCRR::_from(((self.bits >> 7) & 0x01) != 0)
}
#[doc = "Bit 6 - Transfer Complete (master mode)"]
#[inline(always)]
pub fn tc(&self) -> TCR {
TCR::_from(((self.bits >> 6) & 0x01) != 0)
}
#[doc = "Bit 5 - Stop detection flag"]
#[inline(always)]
pub fn stopf(&self) -> STOPFR {
STOPFR::_from(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bit 4 - Not acknowledge received flag"]
#[inline(always)]
pub fn nackf(&self) -> NACKFR {
NACKFR::_from(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 3 - Address matched (slave mode)"]
#[inline(always)]
pub fn addr(&self) -> ADDRR {
ADDRR::_from(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 2 - Receive data register not empty (receivers)"]
#[inline(always)]
pub fn rxne(&self) -> RXNER {
RXNER::_from(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 1 - Transmit interrupt status (transmitters)"]
#[inline(always)]
pub fn txis(&self) -> TXISR {
TXISR::_from(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 0 - Transmit data register empty (transmitters)"]
#[inline(always)]
pub fn txe(&self) -> TXER {
TXER::_from(((self.bits >> 0) & 0x01) != 0)
}
}
impl W {
#[doc = r"Writes raw bits to the register"]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bit 1 - Transmit interrupt status (transmitters)"]
#[inline(always)]
pub fn txis(&mut self) -> _TXISW {
_TXISW { w: self }
}
#[doc = "Bit 0 - Transmit data register empty (transmitters)"]
#[inline(always)]
pub fn txe(&mut self) -> _TXEW {
_TXEW { w: self }
}
}