#[doc = "Reader of register ISR"]
pub type R = crate::R<u32, super::ISR>;
#[doc = "Writer for register ISR"]
pub type W = crate::W<u32, super::ISR>;
#[doc = "Register ISR `reset()`'s with value 0x01"]
impl crate::ResetValue for super::ISR {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0x01
}
}
#[doc = "Transmit data register empty (transmitters) This bit is set by hardware when the I2C_TXDR register is empty. It is cleared when the next data to be sent is written in the I2C_TXDR register. This bit can be written to 1 by software in order to flush the transmit data register I2C_TXDR. Note: This bit is set by hardware when PE=0.\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TXE_A {
#[doc = "0: TXDR register not empty"]
NOTEMPTY = 0,
#[doc = "1: TXDR register empty"]
EMPTY = 1,
}
impl From<TXE_A> for bool {
#[inline(always)]
fn from(variant: TXE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `TXE`"]
pub type TXE_R = crate::R<bool, TXE_A>;
impl TXE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> TXE_A {
match self.bits {
false => TXE_A::NOTEMPTY,
true => TXE_A::EMPTY,
}
}
#[doc = "Checks if the value of the field is `NOTEMPTY`"]
#[inline(always)]
pub fn is_not_empty(&self) -> bool {
*self == TXE_A::NOTEMPTY
}
#[doc = "Checks if the value of the field is `EMPTY`"]
#[inline(always)]
pub fn is_empty(&self) -> bool {
*self == TXE_A::EMPTY
}
}
#[doc = "Write proxy for field `TXE`"]
pub struct TXE_W<'a> {
w: &'a mut W,
}
impl<'a> TXE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TXE_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "TXDR register not empty"]
#[inline(always)]
pub fn not_empty(self) -> &'a mut W {
self.variant(TXE_A::NOTEMPTY)
}
#[doc = "TXDR register empty"]
#[inline(always)]
pub fn empty(self) -> &'a mut W {
self.variant(TXE_A::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 = (self.w.bits & !0x01) | ((value as u32) & 0x01);
self.w
}
}
#[doc = "Transmit interrupt status (transmitters) This bit is set by hardware when the I2C_TXDR register is empty and the data to be transmitted must be written in the I2C_TXDR register. It is cleared when the next data to be sent is written in the I2C_TXDR register. This bit can be written to 1 by software when NOSTRETCH=1 only, in order to generate a TXIS event (interrupt if TXIE=1 or DMA request if TXDMAEN=1). Note: This bit is cleared by hardware when PE=0.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TXIS_A {
#[doc = "0: The TXDR register is not empty"]
NOTEMPTY = 0,
#[doc = "1: The TXDR register is empty and the data to be transmitted must be written in the TXDR register"]
EMPTY = 1,
}
impl From<TXIS_A> for bool {
#[inline(always)]
fn from(variant: TXIS_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `TXIS`"]
pub type TXIS_R = crate::R<bool, TXIS_A>;
impl TXIS_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> TXIS_A {
match self.bits {
false => TXIS_A::NOTEMPTY,
true => TXIS_A::EMPTY,
}
}
#[doc = "Checks if the value of the field is `NOTEMPTY`"]
#[inline(always)]
pub fn is_not_empty(&self) -> bool {
*self == TXIS_A::NOTEMPTY
}
#[doc = "Checks if the value of the field is `EMPTY`"]
#[inline(always)]
pub fn is_empty(&self) -> bool {
*self == TXIS_A::EMPTY
}
}
#[doc = "Write proxy for field `TXIS`"]
pub struct TXIS_W<'a> {
w: &'a mut W,
}
impl<'a> TXIS_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TXIS_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "The TXDR register is not empty"]
#[inline(always)]
pub fn not_empty(self) -> &'a mut W {
self.variant(TXIS_A::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(TXIS_A::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 = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
self.w
}
}
#[doc = "Receive data register not empty (receivers) This bit is set by hardware when the received data is copied into the I2C_RXDR register, and is ready to be read. It is cleared when I2C_RXDR is read. Note: This bit is cleared by hardware when PE=0.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RXNE_A {
#[doc = "0: The RXDR register is empty"]
EMPTY = 0,
#[doc = "1: Received data is copied into the RXDR register, and is ready to be read"]
NOTEMPTY = 1,
}
impl From<RXNE_A> for bool {
#[inline(always)]
fn from(variant: RXNE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `RXNE`"]
pub type RXNE_R = crate::R<bool, RXNE_A>;
impl RXNE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> RXNE_A {
match self.bits {
false => RXNE_A::EMPTY,
true => RXNE_A::NOTEMPTY,
}
}
#[doc = "Checks if the value of the field is `EMPTY`"]
#[inline(always)]
pub fn is_empty(&self) -> bool {
*self == RXNE_A::EMPTY
}
#[doc = "Checks if the value of the field is `NOTEMPTY`"]
#[inline(always)]
pub fn is_not_empty(&self) -> bool {
*self == RXNE_A::NOTEMPTY
}
}
#[doc = "Address matched (slave mode) This bit is set by hardware as soon as the received slave address matched with one of the enabled slave addresses. It is cleared by software by setting ADDRCF bit. Note: This bit is cleared by hardware when PE=0.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ADDR_A {
#[doc = "0: Adress mismatched or not received"]
NOTMATCH = 0,
#[doc = "1: Received slave address matched with one of the enabled slave addresses"]
MATCH = 1,
}
impl From<ADDR_A> for bool {
#[inline(always)]
fn from(variant: ADDR_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `ADDR`"]
pub type ADDR_R = crate::R<bool, ADDR_A>;
impl ADDR_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> ADDR_A {
match self.bits {
false => ADDR_A::NOTMATCH,
true => ADDR_A::MATCH,
}
}
#[doc = "Checks if the value of the field is `NOTMATCH`"]
#[inline(always)]
pub fn is_not_match(&self) -> bool {
*self == ADDR_A::NOTMATCH
}
#[doc = "Checks if the value of the field is `MATCH`"]
#[inline(always)]
pub fn is_match_(&self) -> bool {
*self == ADDR_A::MATCH
}
}
#[doc = "Not Acknowledge received flag This flag is set by hardware when a NACK is received after a byte transmission. It is cleared by software by setting the NACKCF bit. Note: This bit is cleared by hardware when PE=0.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum NACKF_A {
#[doc = "0: No NACK has been received"]
NONACK = 0,
#[doc = "1: NACK has been received"]
NACK = 1,
}
impl From<NACKF_A> for bool {
#[inline(always)]
fn from(variant: NACKF_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `NACKF`"]
pub type NACKF_R = crate::R<bool, NACKF_A>;
impl NACKF_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> NACKF_A {
match self.bits {
false => NACKF_A::NONACK,
true => NACKF_A::NACK,
}
}
#[doc = "Checks if the value of the field is `NONACK`"]
#[inline(always)]
pub fn is_no_nack(&self) -> bool {
*self == NACKF_A::NONACK
}
#[doc = "Checks if the value of the field is `NACK`"]
#[inline(always)]
pub fn is_nack(&self) -> bool {
*self == NACKF_A::NACK
}
}
#[doc = "Stop detection flag This flag is set by hardware when a Stop condition is detected on the bus and the peripheral is involved in this transfer: either as a master, provided that the STOP condition is generated by the peripheral. or as a slave, provided that the peripheral has been addressed previously during this transfer. It is cleared by software by setting the STOPCF bit. Note: This bit is cleared by hardware when PE=0.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum STOPF_A {
#[doc = "0: No Stop condition detected"]
NOSTOP = 0,
#[doc = "1: Stop condition detected"]
STOP = 1,
}
impl From<STOPF_A> for bool {
#[inline(always)]
fn from(variant: STOPF_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `STOPF`"]
pub type STOPF_R = crate::R<bool, STOPF_A>;
impl STOPF_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> STOPF_A {
match self.bits {
false => STOPF_A::NOSTOP,
true => STOPF_A::STOP,
}
}
#[doc = "Checks if the value of the field is `NOSTOP`"]
#[inline(always)]
pub fn is_no_stop(&self) -> bool {
*self == STOPF_A::NOSTOP
}
#[doc = "Checks if the value of the field is `STOP`"]
#[inline(always)]
pub fn is_stop(&self) -> bool {
*self == STOPF_A::STOP
}
}
#[doc = "Transfer Complete (master mode) This flag is set by hardware when RELOAD=0, AUTOEND=0 and NBYTES data have been transferred. It is cleared by software when START bit or STOP bit is set. Note: This bit is cleared by hardware when PE=0.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TC_A {
#[doc = "0: Transfer is not complete"]
NOTCOMPLETE = 0,
#[doc = "1: NBYTES has been transfered"]
COMPLETE = 1,
}
impl From<TC_A> for bool {
#[inline(always)]
fn from(variant: TC_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `TC`"]
pub type TC_R = crate::R<bool, TC_A>;
impl TC_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> TC_A {
match self.bits {
false => TC_A::NOTCOMPLETE,
true => TC_A::COMPLETE,
}
}
#[doc = "Checks if the value of the field is `NOTCOMPLETE`"]
#[inline(always)]
pub fn is_not_complete(&self) -> bool {
*self == TC_A::NOTCOMPLETE
}
#[doc = "Checks if the value of the field is `COMPLETE`"]
#[inline(always)]
pub fn is_complete(&self) -> bool {
*self == TC_A::COMPLETE
}
}
#[doc = "Transfer Complete Reload This flag is set by hardware when RELOAD=1 and NBYTES data have been transferred. It is cleared by software when NBYTES is written to a non-zero value. Note: This bit is cleared by hardware when PE=0. This flag is only for master mode, or for slave mode when the SBC bit is set.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TCR_A {
#[doc = "0: Transfer is not complete"]
NOTCOMPLETE = 0,
#[doc = "1: NBYTES has been transfered"]
COMPLETE = 1,
}
impl From<TCR_A> for bool {
#[inline(always)]
fn from(variant: TCR_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `TCR`"]
pub type TCR_R = crate::R<bool, TCR_A>;
impl TCR_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> TCR_A {
match self.bits {
false => TCR_A::NOTCOMPLETE,
true => TCR_A::COMPLETE,
}
}
#[doc = "Checks if the value of the field is `NOTCOMPLETE`"]
#[inline(always)]
pub fn is_not_complete(&self) -> bool {
*self == TCR_A::NOTCOMPLETE
}
#[doc = "Checks if the value of the field is `COMPLETE`"]
#[inline(always)]
pub fn is_complete(&self) -> bool {
*self == TCR_A::COMPLETE
}
}
#[doc = "Bus error This flag is set by hardware when a misplaced Start or Stop condition is detected whereas the peripheral is involved in the transfer. The flag is not set during the address phase in slave mode. It is cleared by software by setting BERRCF bit. Note: This bit is cleared by hardware when PE=0.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BERR_A {
#[doc = "0: No bus error"]
NOERROR = 0,
#[doc = "1: Misplaced Start and Stop condition is detected"]
ERROR = 1,
}
impl From<BERR_A> for bool {
#[inline(always)]
fn from(variant: BERR_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `BERR`"]
pub type BERR_R = crate::R<bool, BERR_A>;
impl BERR_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> BERR_A {
match self.bits {
false => BERR_A::NOERROR,
true => BERR_A::ERROR,
}
}
#[doc = "Checks if the value of the field is `NOERROR`"]
#[inline(always)]
pub fn is_no_error(&self) -> bool {
*self == BERR_A::NOERROR
}
#[doc = "Checks if the value of the field is `ERROR`"]
#[inline(always)]
pub fn is_error(&self) -> bool {
*self == BERR_A::ERROR
}
}
#[doc = "Arbitration lost This flag is set by hardware in case of arbitration loss. It is cleared by software by setting the ARLOCF bit. Note: This bit is cleared by hardware when PE=0.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ARLO_A {
#[doc = "0: No arbitration lost"]
NOTLOST = 0,
#[doc = "1: Arbitration lost"]
LOST = 1,
}
impl From<ARLO_A> for bool {
#[inline(always)]
fn from(variant: ARLO_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `ARLO`"]
pub type ARLO_R = crate::R<bool, ARLO_A>;
impl ARLO_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> ARLO_A {
match self.bits {
false => ARLO_A::NOTLOST,
true => ARLO_A::LOST,
}
}
#[doc = "Checks if the value of the field is `NOTLOST`"]
#[inline(always)]
pub fn is_not_lost(&self) -> bool {
*self == ARLO_A::NOTLOST
}
#[doc = "Checks if the value of the field is `LOST`"]
#[inline(always)]
pub fn is_lost(&self) -> bool {
*self == ARLO_A::LOST
}
}
#[doc = "Overrun/Underrun (slave mode) This flag is set by hardware in slave mode with NOSTRETCH=1, when an overrun/underrun error occurs. It is cleared by software by setting the OVRCF bit. Note: This bit is cleared by hardware when PE=0.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OVR_A {
#[doc = "0: No overrun/underrun error occurs"]
NOOVERRUN = 0,
#[doc = "1: slave mode with NOSTRETCH=1, when an overrun/underrun error occurs"]
OVERRUN = 1,
}
impl From<OVR_A> for bool {
#[inline(always)]
fn from(variant: OVR_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `OVR`"]
pub type OVR_R = crate::R<bool, OVR_A>;
impl OVR_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> OVR_A {
match self.bits {
false => OVR_A::NOOVERRUN,
true => OVR_A::OVERRUN,
}
}
#[doc = "Checks if the value of the field is `NOOVERRUN`"]
#[inline(always)]
pub fn is_no_overrun(&self) -> bool {
*self == OVR_A::NOOVERRUN
}
#[doc = "Checks if the value of the field is `OVERRUN`"]
#[inline(always)]
pub fn is_overrun(&self) -> bool {
*self == OVR_A::OVERRUN
}
}
#[doc = "PEC Error in reception This flag is set by hardware when the received PEC does not match with the PEC register content. A NACK is automatically sent after the wrong PEC reception. It is cleared by software by setting the PECCF bit. Note: This bit is cleared by hardware when PE=0. If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. Please refer to Section25.3: I2C implementation.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PECERR_A {
#[doc = "0: Received PEC does match with PEC register"]
MATCH = 0,
#[doc = "1: Received PEC does not match with PEC register"]
NOMATCH = 1,
}
impl From<PECERR_A> for bool {
#[inline(always)]
fn from(variant: PECERR_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `PECERR`"]
pub type PECERR_R = crate::R<bool, PECERR_A>;
impl PECERR_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> PECERR_A {
match self.bits {
false => PECERR_A::MATCH,
true => PECERR_A::NOMATCH,
}
}
#[doc = "Checks if the value of the field is `MATCH`"]
#[inline(always)]
pub fn is_match_(&self) -> bool {
*self == PECERR_A::MATCH
}
#[doc = "Checks if the value of the field is `NOMATCH`"]
#[inline(always)]
pub fn is_no_match(&self) -> bool {
*self == PECERR_A::NOMATCH
}
}
#[doc = "Timeout or tLOW detection flag This flag is set by hardware when a timeout or extended clock timeout occurred. It is cleared by software by setting the TIMEOUTCF bit. Note: This bit is cleared by hardware when PE=0. If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. Please refer to Section25.3: I2C implementation.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TIMEOUT_A {
#[doc = "0: No timeout occured"]
NOTIMEOUT = 0,
#[doc = "1: Timeout occured"]
TIMEOUT = 1,
}
impl From<TIMEOUT_A> for bool {
#[inline(always)]
fn from(variant: TIMEOUT_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `TIMEOUT`"]
pub type TIMEOUT_R = crate::R<bool, TIMEOUT_A>;
impl TIMEOUT_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> TIMEOUT_A {
match self.bits {
false => TIMEOUT_A::NOTIMEOUT,
true => TIMEOUT_A::TIMEOUT,
}
}
#[doc = "Checks if the value of the field is `NOTIMEOUT`"]
#[inline(always)]
pub fn is_no_timeout(&self) -> bool {
*self == TIMEOUT_A::NOTIMEOUT
}
#[doc = "Checks if the value of the field is `TIMEOUT`"]
#[inline(always)]
pub fn is_timeout(&self) -> bool {
*self == TIMEOUT_A::TIMEOUT
}
}
#[doc = "SMBus alert This flag is set by hardware when SMBHEN=1 (SMBus host configuration), ALERTEN=1 and a SMBALERT event (falling edge) is detected on SMBA pin. It is cleared by software by setting the ALERTCF bit. Note: This bit is cleared by hardware when PE=0. If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. Please refer to Section25.3: I2C implementation.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ALERT_A {
#[doc = "0: SMBA alert is not detected"]
NOALERT = 0,
#[doc = "1: SMBA alert event is detected on SMBA pin"]
ALERT = 1,
}
impl From<ALERT_A> for bool {
#[inline(always)]
fn from(variant: ALERT_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `ALERT`"]
pub type ALERT_R = crate::R<bool, ALERT_A>;
impl ALERT_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> ALERT_A {
match self.bits {
false => ALERT_A::NOALERT,
true => ALERT_A::ALERT,
}
}
#[doc = "Checks if the value of the field is `NOALERT`"]
#[inline(always)]
pub fn is_no_alert(&self) -> bool {
*self == ALERT_A::NOALERT
}
#[doc = "Checks if the value of the field is `ALERT`"]
#[inline(always)]
pub fn is_alert(&self) -> bool {
*self == ALERT_A::ALERT
}
}
#[doc = "Bus busy This flag indicates that a communication is in progress on the bus. It is set by hardware when a START condition is detected. It is cleared by hardware when a Stop condition is detected, or when PE=0.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BUSY_A {
#[doc = "0: No communication is in progress on the bus"]
NOTBUSY = 0,
#[doc = "1: A communication is in progress on the bus"]
BUSY = 1,
}
impl From<BUSY_A> for bool {
#[inline(always)]
fn from(variant: BUSY_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `BUSY`"]
pub type BUSY_R = crate::R<bool, BUSY_A>;
impl BUSY_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> BUSY_A {
match self.bits {
false => BUSY_A::NOTBUSY,
true => BUSY_A::BUSY,
}
}
#[doc = "Checks if the value of the field is `NOTBUSY`"]
#[inline(always)]
pub fn is_not_busy(&self) -> bool {
*self == BUSY_A::NOTBUSY
}
#[doc = "Checks if the value of the field is `BUSY`"]
#[inline(always)]
pub fn is_busy(&self) -> bool {
*self == BUSY_A::BUSY
}
}
#[doc = "Transfer direction (Slave mode) This flag is updated when an address match event occurs (ADDR=1).\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DIR_A {
#[doc = "0: Write transfer, slave enters receiver mode"]
WRITE = 0,
#[doc = "1: Read transfer, slave enters transmitter mode"]
READ = 1,
}
impl From<DIR_A> for bool {
#[inline(always)]
fn from(variant: DIR_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `DIR`"]
pub type DIR_R = crate::R<bool, DIR_A>;
impl DIR_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> DIR_A {
match self.bits {
false => DIR_A::WRITE,
true => DIR_A::READ,
}
}
#[doc = "Checks if the value of the field is `WRITE`"]
#[inline(always)]
pub fn is_write(&self) -> bool {
*self == DIR_A::WRITE
}
#[doc = "Checks if the value of the field is `READ`"]
#[inline(always)]
pub fn is_read(&self) -> bool {
*self == DIR_A::READ
}
}
#[doc = "Reader of field `ADDCODE`"]
pub type ADDCODE_R = crate::R<u8, u8>;
impl R {
#[doc = "Bit 0 - Transmit data register empty (transmitters) This bit is set by hardware when the I2C_TXDR register is empty. It is cleared when the next data to be sent is written in the I2C_TXDR register. This bit can be written to 1 by software in order to flush the transmit data register I2C_TXDR. Note: This bit is set by hardware when PE=0."]
#[inline(always)]
pub fn txe(&self) -> TXE_R {
TXE_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 1 - Transmit interrupt status (transmitters) This bit is set by hardware when the I2C_TXDR register is empty and the data to be transmitted must be written in the I2C_TXDR register. It is cleared when the next data to be sent is written in the I2C_TXDR register. This bit can be written to 1 by software when NOSTRETCH=1 only, in order to generate a TXIS event (interrupt if TXIE=1 or DMA request if TXDMAEN=1). Note: This bit is cleared by hardware when PE=0."]
#[inline(always)]
pub fn txis(&self) -> TXIS_R {
TXIS_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 2 - Receive data register not empty (receivers) This bit is set by hardware when the received data is copied into the I2C_RXDR register, and is ready to be read. It is cleared when I2C_RXDR is read. Note: This bit is cleared by hardware when PE=0."]
#[inline(always)]
pub fn rxne(&self) -> RXNE_R {
RXNE_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 3 - Address matched (slave mode) This bit is set by hardware as soon as the received slave address matched with one of the enabled slave addresses. It is cleared by software by setting ADDRCF bit. Note: This bit is cleared by hardware when PE=0."]
#[inline(always)]
pub fn addr(&self) -> ADDR_R {
ADDR_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 4 - Not Acknowledge received flag This flag is set by hardware when a NACK is received after a byte transmission. It is cleared by software by setting the NACKCF bit. Note: This bit is cleared by hardware when PE=0."]
#[inline(always)]
pub fn nackf(&self) -> NACKF_R {
NACKF_R::new(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 5 - Stop detection flag This flag is set by hardware when a Stop condition is detected on the bus and the peripheral is involved in this transfer: either as a master, provided that the STOP condition is generated by the peripheral. or as a slave, provided that the peripheral has been addressed previously during this transfer. It is cleared by software by setting the STOPCF bit. Note: This bit is cleared by hardware when PE=0."]
#[inline(always)]
pub fn stopf(&self) -> STOPF_R {
STOPF_R::new(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bit 6 - Transfer Complete (master mode) This flag is set by hardware when RELOAD=0, AUTOEND=0 and NBYTES data have been transferred. It is cleared by software when START bit or STOP bit is set. Note: This bit is cleared by hardware when PE=0."]
#[inline(always)]
pub fn tc(&self) -> TC_R {
TC_R::new(((self.bits >> 6) & 0x01) != 0)
}
#[doc = "Bit 7 - Transfer Complete Reload This flag is set by hardware when RELOAD=1 and NBYTES data have been transferred. It is cleared by software when NBYTES is written to a non-zero value. Note: This bit is cleared by hardware when PE=0. This flag is only for master mode, or for slave mode when the SBC bit is set."]
#[inline(always)]
pub fn tcr(&self) -> TCR_R {
TCR_R::new(((self.bits >> 7) & 0x01) != 0)
}
#[doc = "Bit 8 - Bus error This flag is set by hardware when a misplaced Start or Stop condition is detected whereas the peripheral is involved in the transfer. The flag is not set during the address phase in slave mode. It is cleared by software by setting BERRCF bit. Note: This bit is cleared by hardware when PE=0."]
#[inline(always)]
pub fn berr(&self) -> BERR_R {
BERR_R::new(((self.bits >> 8) & 0x01) != 0)
}
#[doc = "Bit 9 - Arbitration lost This flag is set by hardware in case of arbitration loss. It is cleared by software by setting the ARLOCF bit. Note: This bit is cleared by hardware when PE=0."]
#[inline(always)]
pub fn arlo(&self) -> ARLO_R {
ARLO_R::new(((self.bits >> 9) & 0x01) != 0)
}
#[doc = "Bit 10 - Overrun/Underrun (slave mode) This flag is set by hardware in slave mode with NOSTRETCH=1, when an overrun/underrun error occurs. It is cleared by software by setting the OVRCF bit. Note: This bit is cleared by hardware when PE=0."]
#[inline(always)]
pub fn ovr(&self) -> OVR_R {
OVR_R::new(((self.bits >> 10) & 0x01) != 0)
}
#[doc = "Bit 11 - PEC Error in reception This flag is set by hardware when the received PEC does not match with the PEC register content. A NACK is automatically sent after the wrong PEC reception. It is cleared by software by setting the PECCF bit. Note: This bit is cleared by hardware when PE=0. If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. Please refer to Section25.3: I2C implementation."]
#[inline(always)]
pub fn pecerr(&self) -> PECERR_R {
PECERR_R::new(((self.bits >> 11) & 0x01) != 0)
}
#[doc = "Bit 12 - Timeout or tLOW detection flag This flag is set by hardware when a timeout or extended clock timeout occurred. It is cleared by software by setting the TIMEOUTCF bit. Note: This bit is cleared by hardware when PE=0. If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. Please refer to Section25.3: I2C implementation."]
#[inline(always)]
pub fn timeout(&self) -> TIMEOUT_R {
TIMEOUT_R::new(((self.bits >> 12) & 0x01) != 0)
}
#[doc = "Bit 13 - SMBus alert This flag is set by hardware when SMBHEN=1 (SMBus host configuration), ALERTEN=1 and a SMBALERT event (falling edge) is detected on SMBA pin. It is cleared by software by setting the ALERTCF bit. Note: This bit is cleared by hardware when PE=0. If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. Please refer to Section25.3: I2C implementation."]
#[inline(always)]
pub fn alert(&self) -> ALERT_R {
ALERT_R::new(((self.bits >> 13) & 0x01) != 0)
}
#[doc = "Bit 15 - Bus busy This flag indicates that a communication is in progress on the bus. It is set by hardware when a START condition is detected. It is cleared by hardware when a Stop condition is detected, or when PE=0."]
#[inline(always)]
pub fn busy(&self) -> BUSY_R {
BUSY_R::new(((self.bits >> 15) & 0x01) != 0)
}
#[doc = "Bit 16 - Transfer direction (Slave mode) This flag is updated when an address match event occurs (ADDR=1)."]
#[inline(always)]
pub fn dir(&self) -> DIR_R {
DIR_R::new(((self.bits >> 16) & 0x01) != 0)
}
#[doc = "Bits 17:23 - Address match code (Slave mode) These bits are updated with the received address when an address match event occurs (ADDR = 1). In the case of a 10-bit address, ADDCODE provides the 10-bit header followed by the 2 MSBs of the address."]
#[inline(always)]
pub fn addcode(&self) -> ADDCODE_R {
ADDCODE_R::new(((self.bits >> 17) & 0x7f) as u8)
}
}
impl W {
#[doc = "Bit 0 - Transmit data register empty (transmitters) This bit is set by hardware when the I2C_TXDR register is empty. It is cleared when the next data to be sent is written in the I2C_TXDR register. This bit can be written to 1 by software in order to flush the transmit data register I2C_TXDR. Note: This bit is set by hardware when PE=0."]
#[inline(always)]
pub fn txe(&mut self) -> TXE_W {
TXE_W { w: self }
}
#[doc = "Bit 1 - Transmit interrupt status (transmitters) This bit is set by hardware when the I2C_TXDR register is empty and the data to be transmitted must be written in the I2C_TXDR register. It is cleared when the next data to be sent is written in the I2C_TXDR register. This bit can be written to 1 by software when NOSTRETCH=1 only, in order to generate a TXIS event (interrupt if TXIE=1 or DMA request if TXDMAEN=1). Note: This bit is cleared by hardware when PE=0."]
#[inline(always)]
pub fn txis(&mut self) -> TXIS_W {
TXIS_W { w: self }
}
}