#![allow(non_snake_case, non_upper_case_globals)]
#![allow(non_camel_case_types)]
//! I2C
//!
//! Used by: stm32h743, stm32h743v, stm32h747cm4, stm32h747cm7, stm32h753, stm32h753v, stm32h7b3
use crate::{RORegister, RWRegister, WORegister};
#[cfg(not(feature = "nosync"))]
use core::marker::PhantomData;
/// Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK.
pub mod CR1 {
/// Peripheral enable Note: When PE=0, the I2C SCL and SDA lines are released. Internal state machines and status bits are put back to their reset value. When cleared, PE must be kept low for at least 3 APB clock cycles.
pub mod PE {
/// Offset (0 bits)
pub const offset: u32 = 0;
/// Mask (1 bit: 1 << 0)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Peripheral disabled
pub const Disabled: u32 = 0b0;
/// 0b1: Peripheral enabled
pub const Enabled: u32 = 0b1;
}
}
/// TX Interrupt enable
pub mod TXIE {
/// Offset (1 bits)
pub const offset: u32 = 1;
/// Mask (1 bit: 1 << 1)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Transmit (TXIS) interrupt disabled
pub const Disabled: u32 = 0b0;
/// 0b1: Transmit (TXIS) interrupt enabled
pub const Enabled: u32 = 0b1;
}
}
/// RX Interrupt enable
pub mod RXIE {
/// Offset (2 bits)
pub const offset: u32 = 2;
/// Mask (1 bit: 1 << 2)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Receive (RXNE) interrupt disabled
pub const Disabled: u32 = 0b0;
/// 0b1: Receive (RXNE) interrupt enabled
pub const Enabled: u32 = 0b1;
}
}
/// Address match Interrupt enable (slave only)
pub mod ADDRIE {
/// Offset (3 bits)
pub const offset: u32 = 3;
/// Mask (1 bit: 1 << 3)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Address match (ADDR) interrupts disabled
pub const Disabled: u32 = 0b0;
/// 0b1: Address match (ADDR) interrupts enabled
pub const Enabled: u32 = 0b1;
}
}
/// Not acknowledge received Interrupt enable
pub mod NACKIE {
/// Offset (4 bits)
pub const offset: u32 = 4;
/// Mask (1 bit: 1 << 4)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Not acknowledge (NACKF) received interrupts disabled
pub const Disabled: u32 = 0b0;
/// 0b1: Not acknowledge (NACKF) received interrupts enabled
pub const Enabled: u32 = 0b1;
}
}
/// STOP detection Interrupt enable
pub mod STOPIE {
/// Offset (5 bits)
pub const offset: u32 = 5;
/// Mask (1 bit: 1 << 5)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Stop detection (STOPF) interrupt disabled
pub const Disabled: u32 = 0b0;
/// 0b1: Stop detection (STOPF) interrupt enabled
pub const Enabled: u32 = 0b1;
}
}
/// Transfer Complete interrupt enable Note: Any of these events will generate an interrupt: Transfer Complete (TC) Transfer Complete Reload (TCR)
pub mod TCIE {
/// Offset (6 bits)
pub const offset: u32 = 6;
/// Mask (1 bit: 1 << 6)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Transfer Complete interrupt disabled
pub const Disabled: u32 = 0b0;
/// 0b1: Transfer Complete interrupt enabled
pub const Enabled: u32 = 0b1;
}
}
/// Error interrupts enable Note: Any of these errors generate an interrupt: Arbitration Loss (ARLO) Bus Error detection (BERR) Overrun/Underrun (OVR) Timeout detection (TIMEOUT) PEC error detection (PECERR) Alert pin event detection (ALERT)
pub mod ERRIE {
/// Offset (7 bits)
pub const offset: u32 = 7;
/// Mask (1 bit: 1 << 7)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Error detection interrupts disabled
pub const Disabled: u32 = 0b0;
/// 0b1: Error detection interrupts enabled
pub const Enabled: u32 = 0b1;
}
}
/// Digital noise filter These bits are used to configure the digital noise filter on SDA and SCL input. The digital filter will filter spikes with a length of up to DNF\[3:0\] * tI2CCLK ... Note: If the analog filter is also enabled, the digital filter is added to the analog filter. This filter can only be programmed when the I2C is disabled (PE = 0).
pub mod DNF {
/// Offset (8 bits)
pub const offset: u32 = 8;
/// Mask (4 bits: 0b1111 << 8)
pub const mask: u32 = 0b1111 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0000: Digital filter disabled
pub const NoFilter: u32 = 0b0000;
/// 0b0001: Digital filter enabled and filtering capability up to 1 tI2CCLK
pub const Filter1: u32 = 0b0001;
/// 0b0010: Digital filter enabled and filtering capability up to 2 tI2CCLK
pub const Filter2: u32 = 0b0010;
/// 0b0011: Digital filter enabled and filtering capability up to 3 tI2CCLK
pub const Filter3: u32 = 0b0011;
/// 0b0100: Digital filter enabled and filtering capability up to 4 tI2CCLK
pub const Filter4: u32 = 0b0100;
/// 0b0101: Digital filter enabled and filtering capability up to 5 tI2CCLK
pub const Filter5: u32 = 0b0101;
/// 0b0110: Digital filter enabled and filtering capability up to 6 tI2CCLK
pub const Filter6: u32 = 0b0110;
/// 0b0111: Digital filter enabled and filtering capability up to 7 tI2CCLK
pub const Filter7: u32 = 0b0111;
/// 0b1000: Digital filter enabled and filtering capability up to 8 tI2CCLK
pub const Filter8: u32 = 0b1000;
/// 0b1001: Digital filter enabled and filtering capability up to 9 tI2CCLK
pub const Filter9: u32 = 0b1001;
/// 0b1010: Digital filter enabled and filtering capability up to 10 tI2CCLK
pub const Filter10: u32 = 0b1010;
/// 0b1011: Digital filter enabled and filtering capability up to 11 tI2CCLK
pub const Filter11: u32 = 0b1011;
/// 0b1100: Digital filter enabled and filtering capability up to 12 tI2CCLK
pub const Filter12: u32 = 0b1100;
/// 0b1101: Digital filter enabled and filtering capability up to 13 tI2CCLK
pub const Filter13: u32 = 0b1101;
/// 0b1110: Digital filter enabled and filtering capability up to 14 tI2CCLK
pub const Filter14: u32 = 0b1110;
/// 0b1111: Digital filter enabled and filtering capability up to 15 tI2CCLK
pub const Filter15: u32 = 0b1111;
}
}
/// Analog noise filter OFF Note: This bit can only be programmed when the I2C is disabled (PE = 0).
pub mod ANFOFF {
/// Offset (12 bits)
pub const offset: u32 = 12;
/// Mask (1 bit: 1 << 12)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Analog noise filter enabled
pub const Enabled: u32 = 0b0;
/// 0b1: Analog noise filter disabled
pub const Disabled: u32 = 0b1;
}
}
/// DMA transmission requests enable
pub mod TXDMAEN {
/// Offset (14 bits)
pub const offset: u32 = 14;
/// Mask (1 bit: 1 << 14)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: DMA mode disabled for transmission
pub const Disabled: u32 = 0b0;
/// 0b1: DMA mode enabled for transmission
pub const Enabled: u32 = 0b1;
}
}
/// DMA reception requests enable
pub mod RXDMAEN {
/// Offset (15 bits)
pub const offset: u32 = 15;
/// Mask (1 bit: 1 << 15)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: DMA mode disabled for reception
pub const Disabled: u32 = 0b0;
/// 0b1: DMA mode enabled for reception
pub const Enabled: u32 = 0b1;
}
}
/// Slave byte control This bit is used to enable hardware byte control in slave mode.
pub mod SBC {
/// Offset (16 bits)
pub const offset: u32 = 16;
/// Mask (1 bit: 1 << 16)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Slave byte control disabled
pub const Disabled: u32 = 0b0;
/// 0b1: Slave byte control enabled
pub const Enabled: u32 = 0b1;
}
}
/// Clock stretching disable This bit is used to disable clock stretching in slave mode. It must be kept cleared in master mode. Note: This bit can only be programmed when the I2C is disabled (PE = 0).
pub mod NOSTRETCH {
/// Offset (17 bits)
pub const offset: u32 = 17;
/// Mask (1 bit: 1 << 17)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Clock stretching enabled
pub const Enabled: u32 = 0b0;
/// 0b1: Clock stretching disabled
pub const Disabled: u32 = 0b1;
}
}
/// Wakeup from Stop mode enable Note: If the Wakeup from Stop mode feature is not supported, this bit is reserved and forced by hardware to 0. Please refer to Section25.3: I2C implementation. Note: WUPEN can be set only when DNF = 0000
pub mod WUPEN {
/// Offset (18 bits)
pub const offset: u32 = 18;
/// Mask (1 bit: 1 << 18)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Wakeup from Stop mode disabled
pub const Disabled: u32 = 0b0;
/// 0b1: Wakeup from Stop mode enabled
pub const Enabled: u32 = 0b1;
}
}
/// General call enable
pub mod GCEN {
/// Offset (19 bits)
pub const offset: u32 = 19;
/// Mask (1 bit: 1 << 19)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: General call disabled. Address 0b00000000 is NACKed
pub const Disabled: u32 = 0b0;
/// 0b1: General call enabled. Address 0b00000000 is ACKed
pub const Enabled: u32 = 0b1;
}
}
/// SMBus Host address enable Note: If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. Please refer to Section25.3: I2C implementation.
pub mod SMBHEN {
/// Offset (20 bits)
pub const offset: u32 = 20;
/// Mask (1 bit: 1 << 20)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Host address disabled. Address 0b0001000x is NACKed
pub const Disabled: u32 = 0b0;
/// 0b1: Host address enabled. Address 0b0001000x is ACKed
pub const Enabled: u32 = 0b1;
}
}
/// SMBus Device Default address enable Note: If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. Please refer to Section25.3: I2C implementation.
pub mod SMBDEN {
/// Offset (21 bits)
pub const offset: u32 = 21;
/// Mask (1 bit: 1 << 21)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Device default address disabled. Address 0b1100001x is NACKed
pub const Disabled: u32 = 0b0;
/// 0b1: Device default address enabled. Address 0b1100001x is ACKed
pub const Enabled: u32 = 0b1;
}
}
/// SMBus alert enable Device mode (SMBHEN=0): Host mode (SMBHEN=1): Note: When ALERTEN=0, the SMBA pin can be used as a standard GPIO. If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. Please refer to Section25.3: I2C implementation.
pub mod ALERTEN {
/// Offset (22 bits)
pub const offset: u32 = 22;
/// Mask (1 bit: 1 << 22)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: In device mode (SMBHEN=Disabled) Releases SMBA pin high and Alert Response Address Header disabled (0001100x) followed by NACK. In host mode (SMBHEN=Enabled) SMBus Alert pin (SMBA) not supported
pub const Disabled: u32 = 0b0;
/// 0b1: In device mode (SMBHEN=Disabled) Drives SMBA pin low and Alert Response Address Header enabled (0001100x) followed by ACK.In host mode (SMBHEN=Enabled) SMBus Alert pin (SMBA) supported
pub const Enabled: u32 = 0b1;
}
}
/// PEC enable Note: If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. Please refer to Section25.3: I2C implementation.
pub mod PECEN {
/// Offset (23 bits)
pub const offset: u32 = 23;
/// Mask (1 bit: 1 << 23)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: PEC calculation disabled
pub const Disabled: u32 = 0b0;
/// 0b1: PEC calculation enabled
pub const Enabled: u32 = 0b1;
}
}
}
/// Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK.
pub mod CR2 {
/// Transfer direction (master mode) Note: Changing this bit when the START bit is set is not allowed.
pub mod RD_WRN {
/// Offset (10 bits)
pub const offset: u32 = 10;
/// Mask (1 bit: 1 << 10)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Master requests a write transfer
pub const Write: u32 = 0b0;
/// 0b1: Master requests a read transfer
pub const Read: u32 = 0b1;
}
}
/// 10-bit addressing mode (master mode) Note: Changing this bit when the START bit is set is not allowed.
pub mod ADD10 {
/// Offset (11 bits)
pub const offset: u32 = 11;
/// Mask (1 bit: 1 << 11)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: The master operates in 7-bit addressing mode
pub const Bit7: u32 = 0b0;
/// 0b1: The master operates in 10-bit addressing mode
pub const Bit10: u32 = 0b1;
}
}
/// 10-bit address header only read direction (master receiver mode) Note: Changing this bit when the START bit is set is not allowed.
pub mod HEAD10R {
/// Offset (12 bits)
pub const offset: u32 = 12;
/// Mask (1 bit: 1 << 12)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: The master sends the complete 10 bit slave address read sequence
pub const Complete: u32 = 0b0;
/// 0b1: The master only sends the 1st 7 bits of the 10 bit address, followed by Read direction
pub const Partial: u32 = 0b1;
}
}
/// Start generation This bit is set by software, and cleared by hardware after the Start followed by the address sequence is sent, by an arbitration loss, by a timeout error detection, or when PE = 0. It can also be cleared by software by writing 1 to the ADDRCF bit in the I2C_ICR register. If the I2C is already in master mode with AUTOEND = 0, setting this bit generates a Repeated Start condition when RELOAD=0, after the end of the NBYTES transfer. Otherwise setting this bit will generate a START condition once the bus is free. Note: Writing 0 to this bit has no effect. The START bit can be set even if the bus is BUSY or I2C is in slave mode. This bit has no effect when RELOAD is set.
pub mod START {
/// Offset (13 bits)
pub const offset: u32 = 13;
/// Mask (1 bit: 1 << 13)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: No Start generation
pub const NoStart: u32 = 0b0;
/// 0b1: Restart/Start generation
pub const Start: u32 = 0b1;
}
}
/// Stop generation (master mode) The bit is set by software, cleared by hardware when a Stop condition is detected, or when PE = 0. In Master Mode: Note: Writing 0 to this bit has no effect.
pub mod STOP {
/// Offset (14 bits)
pub const offset: u32 = 14;
/// Mask (1 bit: 1 << 14)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: No Stop generation
pub const NoStop: u32 = 0b0;
/// 0b1: Stop generation after current byte transfer
pub const Stop: u32 = 0b1;
}
}
/// NACK generation (slave mode) The bit is set by software, cleared by hardware when the NACK is sent, or when a STOP condition or an Address matched is received, or when PE=0. Note: Writing 0 to this bit has no effect. This bit is used in slave mode only: in master receiver mode, NACK is automatically generated after last byte preceding STOP or RESTART condition, whatever the NACK bit value. When an overrun occurs in slave receiver NOSTRETCH mode, a NACK is automatically generated whatever the NACK bit value. When hardware PEC checking is enabled (PECBYTE=1), the PEC acknowledge value does not depend on the NACK value.
pub mod NACK {
/// Offset (15 bits)
pub const offset: u32 = 15;
/// Mask (1 bit: 1 << 15)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: an ACK is sent after current received byte
pub const Ack: u32 = 0b0;
/// 0b1: a NACK is sent after current received byte
pub const Nack: u32 = 0b1;
}
}
/// Number of bytes The number of bytes to be transmitted/received is programmed there. This field is dont care in slave mode with SBC=0. Note: Changing these bits when the START bit is set is not allowed.
pub mod NBYTES {
/// Offset (16 bits)
pub const offset: u32 = 16;
/// Mask (8 bits: 0xff << 16)
pub const mask: u32 = 0xff << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
/// NBYTES reload mode This bit is set and cleared by software.
pub mod RELOAD {
/// Offset (24 bits)
pub const offset: u32 = 24;
/// Mask (1 bit: 1 << 24)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: The transfer is completed after the NBYTES data transfer (STOP or RESTART will follow)
pub const Completed: u32 = 0b0;
/// 0b1: The transfer is not completed after the NBYTES data transfer (NBYTES will be reloaded)
pub const NotCompleted: u32 = 0b1;
}
}
/// Automatic end mode (master mode) This bit is set and cleared by software. Note: This bit has no effect in slave mode or when the RELOAD bit is set.
pub mod AUTOEND {
/// Offset (25 bits)
pub const offset: u32 = 25;
/// Mask (1 bit: 1 << 25)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Software end mode: TC flag is set when NBYTES data are transferred, stretching SCL low
pub const Software: u32 = 0b0;
/// 0b1: Automatic end mode: a STOP condition is automatically sent when NBYTES data are transferred
pub const Automatic: u32 = 0b1;
}
}
/// Packet error checking byte This bit is set by software, and cleared by hardware when the PEC is transferred, or when a STOP condition or an Address matched is received, also when PE=0. Note: Writing 0 to this bit has no effect. This bit has no effect when RELOAD is set. This bit has no effect is slave mode when SBC=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.
pub mod PECBYTE {
/// Offset (26 bits)
pub const offset: u32 = 26;
/// Mask (1 bit: 1 << 26)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: No PEC transfer
pub const NoPec: u32 = 0b0;
/// 0b1: PEC transmission/reception is requested
pub const Pec: u32 = 0b1;
}
}
/// Slave address bit 0 (master mode) In 7-bit addressing mode (ADD10 = 0): This bit is dont care In 10-bit addressing mode (ADD10 = 1): This bit should be written with bit 0 of the slave address to be sent Note: Changing these bits when the START bit is set is not allowed.
pub mod SADD {
/// Offset (0 bits)
pub const offset: u32 = 0;
/// Mask (10 bits: 0x3ff << 0)
pub const mask: u32 = 0x3ff << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
}
/// Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK.
pub mod OAR1 {
/// Interface address 7-bit addressing mode: dont care 10-bit addressing mode: bits 9:8 of address Note: These bits can be written only when OA1EN=0. OA1\[7:1\]: Interface address Bits 7:1 of address Note: These bits can be written only when OA1EN=0. OA1\[0\]: Interface address 7-bit addressing mode: dont care 10-bit addressing mode: bit 0 of address Note: This bit can be written only when OA1EN=0.
pub mod OA1 {
/// Offset (0 bits)
pub const offset: u32 = 0;
/// Mask (10 bits: 0x3ff << 0)
pub const mask: u32 = 0x3ff << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
/// Own Address 1 10-bit mode Note: This bit can be written only when OA1EN=0.
pub mod OA1MODE {
/// Offset (10 bits)
pub const offset: u32 = 10;
/// Mask (1 bit: 1 << 10)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Own address 1 is a 7-bit address
pub const Bit7: u32 = 0b0;
/// 0b1: Own address 1 is a 10-bit address
pub const Bit10: u32 = 0b1;
}
}
/// Own Address 1 enable
pub mod OA1EN {
/// Offset (15 bits)
pub const offset: u32 = 15;
/// Mask (1 bit: 1 << 15)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Own address 1 disabled. The received slave address OA1 is NACKed
pub const Disabled: u32 = 0b0;
/// 0b1: Own address 1 enabled. The received slave address OA1 is ACKed
pub const Enabled: u32 = 0b1;
}
}
}
/// Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK.
pub mod OAR2 {
/// Interface address bits 7:1 of address Note: These bits can be written only when OA2EN=0.
pub mod OA2 {
/// Offset (1 bits)
pub const offset: u32 = 1;
/// Mask (7 bits: 0x7f << 1)
pub const mask: u32 = 0x7f << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
/// Own Address 2 masks Note: These bits can be written only when OA2EN=0. As soon as OA2MSK is not equal to 0, the reserved I2C addresses (0b0000xxx and 0b1111xxx) are not acknowledged even if the comparison matches.
pub mod OA2MSK {
/// Offset (8 bits)
pub const offset: u32 = 8;
/// Mask (3 bits: 0b111 << 8)
pub const mask: u32 = 0b111 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b000: No mask
pub const NoMask: u32 = 0b000;
/// 0b001: OA2\[1\] is masked and don’t care. Only OA2\[7:2\] are compared
pub const Mask1: u32 = 0b001;
/// 0b010: OA2\[2:1\] are masked and don’t care. Only OA2\[7:3\] are compared
pub const Mask2: u32 = 0b010;
/// 0b011: OA2\[3:1\] are masked and don’t care. Only OA2\[7:4\] are compared
pub const Mask3: u32 = 0b011;
/// 0b100: OA2\[4:1\] are masked and don’t care. Only OA2\[7:5\] are compared
pub const Mask4: u32 = 0b100;
/// 0b101: OA2\[5:1\] are masked and don’t care. Only OA2\[7:6\] are compared
pub const Mask5: u32 = 0b101;
/// 0b110: OA2\[6:1\] are masked and don’t care. Only OA2\[7\] is compared.
pub const Mask6: u32 = 0b110;
/// 0b111: OA2\[7:1\] are masked and don’t care. No comparison is done, and all (except reserved) 7-bit received addresses are acknowledged
pub const Mask7: u32 = 0b111;
}
}
/// Own Address 2 enable
pub mod OA2EN {
/// Offset (15 bits)
pub const offset: u32 = 15;
/// Mask (1 bit: 1 << 15)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Own address 2 disabled. The received slave address OA2 is NACKed
pub const Disabled: u32 = 0b0;
/// 0b1: Own address 2 enabled. The received slave address OA2 is ACKed
pub const Enabled: u32 = 0b1;
}
}
}
/// Access: No wait states
pub mod TIMINGR {
/// SCL low period (master mode) This field is used to generate the SCL low period in master mode. tSCLL = (SCLL+1) x tPRESC Note: SCLL is also used to generate tBUF and tSU:STA timings.
pub mod SCLL {
/// Offset (0 bits)
pub const offset: u32 = 0;
/// Mask (8 bits: 0xff << 0)
pub const mask: u32 = 0xff << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
/// SCL high period (master mode) This field is used to generate the SCL high period in master mode. tSCLH = (SCLH+1) x tPRESC Note: SCLH is also used to generate tSU:STO and tHD:STA timing.
pub mod SCLH {
/// Offset (8 bits)
pub const offset: u32 = 8;
/// Mask (8 bits: 0xff << 8)
pub const mask: u32 = 0xff << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
/// Data hold time This field is used to generate the delay tSDADEL between SCL falling edge and SDA edge. In master mode and in slave mode with NOSTRETCH = 0, the SCL line is stretched low during tSDADEL. tSDADEL= SDADEL x tPRESC Note: SDADEL is used to generate tHD:DAT timing.
pub mod SDADEL {
/// Offset (16 bits)
pub const offset: u32 = 16;
/// Mask (4 bits: 0b1111 << 16)
pub const mask: u32 = 0b1111 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
/// Data setup time This field is used to generate a delay tSCLDEL between SDA edge and SCL rising edge. In master mode and in slave mode with NOSTRETCH = 0, the SCL line is stretched low during tSCLDEL. tSCLDEL = (SCLDEL+1) x tPRESC Note: tSCLDEL is used to generate tSU:DAT timing.
pub mod SCLDEL {
/// Offset (20 bits)
pub const offset: u32 = 20;
/// Mask (4 bits: 0b1111 << 20)
pub const mask: u32 = 0b1111 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
/// Timing prescaler This field is used to prescale I2CCLK in order to generate the clock period tPRESC used for data setup and hold counters (refer to I2C timings on page9) and for SCL high and low level counters (refer to I2C master initialization on page24). tPRESC = (PRESC+1) x tI2CCLK
pub mod PRESC {
/// Offset (28 bits)
pub const offset: u32 = 28;
/// Mask (4 bits: 0b1111 << 28)
pub const mask: u32 = 0b1111 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
}
/// Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK.
pub mod TIMEOUTR {
/// Bus Timeout A This field is used to configure: The SCL low timeout condition tTIMEOUT when TIDLE=0 tTIMEOUT= (TIMEOUTA+1) x 2048 x tI2CCLK The bus idle condition (both SCL and SDA high) when TIDLE=1 tIDLE= (TIMEOUTA+1) x 4 x tI2CCLK Note: These bits can be written only when TIMOUTEN=0.
pub mod TIMEOUTA {
/// Offset (0 bits)
pub const offset: u32 = 0;
/// Mask (12 bits: 0xfff << 0)
pub const mask: u32 = 0xfff << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
/// Idle clock timeout detection Note: This bit can be written only when TIMOUTEN=0.
pub mod TIDLE {
/// Offset (12 bits)
pub const offset: u32 = 12;
/// Mask (1 bit: 1 << 12)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: TIMEOUTA is used to detect SCL low timeout
pub const Disabled: u32 = 0b0;
/// 0b1: TIMEOUTA is used to detect both SCL and SDA high timeout (bus idle condition)
pub const Enabled: u32 = 0b1;
}
}
/// Clock timeout enable
pub mod TIMOUTEN {
/// Offset (15 bits)
pub const offset: u32 = 15;
/// Mask (1 bit: 1 << 15)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: SCL timeout detection is disabled
pub const Disabled: u32 = 0b0;
/// 0b1: SCL timeout detection is enabled
pub const Enabled: u32 = 0b1;
}
}
/// Bus timeout B This field is used to configure the cumulative clock extension timeout: In master mode, the master cumulative clock low extend time (tLOW:MEXT) is detected In slave mode, the slave cumulative clock low extend time (tLOW:SEXT) is detected tLOW:EXT= (TIMEOUTB+1) x 2048 x tI2CCLK Note: These bits can be written only when TEXTEN=0.
pub mod TIMEOUTB {
/// Offset (16 bits)
pub const offset: u32 = 16;
/// Mask (12 bits: 0xfff << 16)
pub const mask: u32 = 0xfff << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
/// Extended clock timeout enable
pub mod TEXTEN {
/// Offset (31 bits)
pub const offset: u32 = 31;
/// Mask (1 bit: 1 << 31)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Extended clock timeout detection is disabled
pub const Disabled: u32 = 0b0;
/// 0b1: Extended clock timeout detection is enabled
pub const Enabled: u32 = 0b1;
}
}
}
/// Access: No wait states
pub mod ISR {
/// 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.
pub mod TXE {
/// Offset (0 bits)
pub const offset: u32 = 0;
/// Mask (1 bit: 1 << 0)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: TXDR register not empty
pub const NotEmpty: u32 = 0b0;
/// 0b1: TXDR register empty
pub const Empty: u32 = 0b1;
}
}
/// 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.
pub mod TXIS {
/// Offset (1 bits)
pub const offset: u32 = 1;
/// Mask (1 bit: 1 << 1)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: The TXDR register is not empty
pub const NotEmpty: u32 = 0b0;
/// 0b1: The TXDR register is empty and the data to be transmitted must be written in the TXDR register
pub const Empty: u32 = 0b1;
}
}
/// 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.
pub mod RXNE {
/// Offset (2 bits)
pub const offset: u32 = 2;
/// Mask (1 bit: 1 << 2)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: The RXDR register is empty
pub const Empty: u32 = 0b0;
/// 0b1: Received data is copied into the RXDR register, and is ready to be read
pub const NotEmpty: u32 = 0b1;
}
}
/// 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.
pub mod ADDR {
/// Offset (3 bits)
pub const offset: u32 = 3;
/// Mask (1 bit: 1 << 3)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Adress mismatched or not received
pub const NotMatch: u32 = 0b0;
/// 0b1: Received slave address matched with one of the enabled slave addresses
pub const Match: u32 = 0b1;
}
}
/// 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.
pub mod NACKF {
/// Offset (4 bits)
pub const offset: u32 = 4;
/// Mask (1 bit: 1 << 4)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: No NACK has been received
pub const NoNack: u32 = 0b0;
/// 0b1: NACK has been received
pub const Nack: u32 = 0b1;
}
}
/// 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.
pub mod STOPF {
/// Offset (5 bits)
pub const offset: u32 = 5;
/// Mask (1 bit: 1 << 5)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: No Stop condition detected
pub const NoStop: u32 = 0b0;
/// 0b1: Stop condition detected
pub const Stop: u32 = 0b1;
}
}
/// 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.
pub mod TC {
/// Offset (6 bits)
pub const offset: u32 = 6;
/// Mask (1 bit: 1 << 6)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Transfer is not complete
pub const NotComplete: u32 = 0b0;
/// 0b1: NBYTES has been transfered
pub const Complete: u32 = 0b1;
}
}
/// 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.
pub mod TCR {
/// Offset (7 bits)
pub const offset: u32 = 7;
/// Mask (1 bit: 1 << 7)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
pub use super::TC::RW;
}
/// 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.
pub mod BERR {
/// Offset (8 bits)
pub const offset: u32 = 8;
/// Mask (1 bit: 1 << 8)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: No bus error
pub const NoError: u32 = 0b0;
/// 0b1: Misplaced Start and Stop condition is detected
pub const Error: u32 = 0b1;
}
}
/// 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.
pub mod ARLO {
/// Offset (9 bits)
pub const offset: u32 = 9;
/// Mask (1 bit: 1 << 9)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: No arbitration lost
pub const NotLost: u32 = 0b0;
/// 0b1: Arbitration lost
pub const Lost: u32 = 0b1;
}
}
/// 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.
pub mod OVR {
/// Offset (10 bits)
pub const offset: u32 = 10;
/// Mask (1 bit: 1 << 10)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: No overrun/underrun error occurs
pub const NoOverrun: u32 = 0b0;
/// 0b1: slave mode with NOSTRETCH=1, when an overrun/underrun error occurs
pub const Overrun: u32 = 0b1;
}
}
/// 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.
pub mod PECERR {
/// Offset (11 bits)
pub const offset: u32 = 11;
/// Mask (1 bit: 1 << 11)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Received PEC does match with PEC register
pub const Match: u32 = 0b0;
/// 0b1: Received PEC does not match with PEC register
pub const NoMatch: u32 = 0b1;
}
}
/// 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.
pub mod TIMEOUT {
/// Offset (12 bits)
pub const offset: u32 = 12;
/// Mask (1 bit: 1 << 12)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: No timeout occured
pub const NoTimeout: u32 = 0b0;
/// 0b1: Timeout occured
pub const Timeout: u32 = 0b1;
}
}
/// 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.
pub mod ALERT {
/// Offset (13 bits)
pub const offset: u32 = 13;
/// Mask (1 bit: 1 << 13)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: SMBA alert is not detected
pub const NoAlert: u32 = 0b0;
/// 0b1: SMBA alert event is detected on SMBA pin
pub const Alert: u32 = 0b1;
}
}
/// 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.
pub mod BUSY {
/// Offset (15 bits)
pub const offset: u32 = 15;
/// Mask (1 bit: 1 << 15)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: No communication is in progress on the bus
pub const NotBusy: u32 = 0b0;
/// 0b1: A communication is in progress on the bus
pub const Busy: u32 = 0b1;
}
}
/// Transfer direction (Slave mode) This flag is updated when an address match event occurs (ADDR=1).
pub mod DIR {
/// Offset (16 bits)
pub const offset: u32 = 16;
/// Mask (1 bit: 1 << 16)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b0: Write transfer, slave enters receiver mode
pub const Write: u32 = 0b0;
/// 0b1: Read transfer, slave enters transmitter mode
pub const Read: u32 = 0b1;
}
}
/// 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.
pub mod ADDCODE {
/// Offset (17 bits)
pub const offset: u32 = 17;
/// Mask (7 bits: 0x7f << 17)
pub const mask: u32 = 0x7f << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
}
/// Access: No wait states
pub mod ICR {
/// Address matched flag clear Writing 1 to this bit clears the ADDR flag in the I2C_ISR register. Writing 1 to this bit also clears the START bit in the I2C_CR2 register.
pub mod ADDRCF {
/// Offset (3 bits)
pub const offset: u32 = 3;
/// Mask (1 bit: 1 << 3)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b1: Clears the ADDR flag in ISR register
pub const Clear: u32 = 0b1;
}
}
/// Not Acknowledge flag clear Writing 1 to this bit clears the ACKF flag in I2C_ISR register.
pub mod NACKCF {
/// Offset (4 bits)
pub const offset: u32 = 4;
/// Mask (1 bit: 1 << 4)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b1: Clears the NACK flag in ISR register
pub const Clear: u32 = 0b1;
}
}
/// Stop detection flag clear Writing 1 to this bit clears the STOPF flag in the I2C_ISR register.
pub mod STOPCF {
/// Offset (5 bits)
pub const offset: u32 = 5;
/// Mask (1 bit: 1 << 5)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b1: Clears the STOP flag in ISR register
pub const Clear: u32 = 0b1;
}
}
/// Bus error flag clear Writing 1 to this bit clears the BERRF flag in the I2C_ISR register.
pub mod BERRCF {
/// Offset (8 bits)
pub const offset: u32 = 8;
/// Mask (1 bit: 1 << 8)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b1: Clears the BERR flag in ISR register
pub const Clear: u32 = 0b1;
}
}
/// Arbitration Lost flag clear Writing 1 to this bit clears the ARLO flag in the I2C_ISR register.
pub mod ARLOCF {
/// Offset (9 bits)
pub const offset: u32 = 9;
/// Mask (1 bit: 1 << 9)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b1: Clears the ARLO flag in ISR register
pub const Clear: u32 = 0b1;
}
}
/// Overrun/Underrun flag clear Writing 1 to this bit clears the OVR flag in the I2C_ISR register.
pub mod OVRCF {
/// Offset (10 bits)
pub const offset: u32 = 10;
/// Mask (1 bit: 1 << 10)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b1: Clears the OVR flag in ISR register
pub const Clear: u32 = 0b1;
}
}
/// PEC Error flag clear Writing 1 to this bit clears the PECERR flag in the I2C_ISR register. Note: If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. Please refer to Section25.3: I2C implementation.
pub mod PECCF {
/// Offset (11 bits)
pub const offset: u32 = 11;
/// Mask (1 bit: 1 << 11)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b1: Clears the PEC flag in ISR register
pub const Clear: u32 = 0b1;
}
}
/// Timeout detection flag clear Writing 1 to this bit clears the TIMEOUT flag in the I2C_ISR register. Note: If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. Please refer to Section25.3: I2C implementation.
pub mod TIMOUTCF {
/// Offset (12 bits)
pub const offset: u32 = 12;
/// Mask (1 bit: 1 << 12)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b1: Clears the TIMOUT flag in ISR register
pub const Clear: u32 = 0b1;
}
}
/// Alert flag clear Writing 1 to this bit clears the ALERT flag in the I2C_ISR register. Note: If the SMBus feature is not supported, this bit is reserved and forced by hardware to 0. Please refer to Section25.3: I2C implementation.
pub mod ALERTCF {
/// Offset (13 bits)
pub const offset: u32 = 13;
/// Mask (1 bit: 1 << 13)
pub const mask: u32 = 1 << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values
pub mod RW {
/// 0b1: Clears the ALERT flag in ISR register
pub const Clear: u32 = 0b1;
}
}
}
/// Access: No wait states
pub mod PECR {
/// Packet error checking register This field contains the internal PEC when PECEN=1. The PEC is cleared by hardware when PE=0.
pub mod PEC {
/// Offset (0 bits)
pub const offset: u32 = 0;
/// Mask (8 bits: 0xff << 0)
pub const mask: u32 = 0xff << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
}
/// Access: No wait states
pub mod RXDR {
/// 8-bit receive data Data byte received from the I2C bus.
pub mod RXDATA {
/// Offset (0 bits)
pub const offset: u32 = 0;
/// Mask (8 bits: 0xff << 0)
pub const mask: u32 = 0xff << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
}
/// Access: No wait states
pub mod TXDR {
/// 8-bit transmit data Data byte to be transmitted to the I2C bus. Note: These bits can be written only when TXE=1.
pub mod TXDATA {
/// Offset (0 bits)
pub const offset: u32 = 0;
/// Mask (8 bits: 0xff << 0)
pub const mask: u32 = 0xff << offset;
/// Read-only values (empty)
pub mod R {}
/// Write-only values (empty)
pub mod W {}
/// Read-write values (empty)
pub mod RW {}
}
}
#[repr(C)]
pub struct RegisterBlock {
/// Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK.
pub CR1: RWRegister<u32>,
/// Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK.
pub CR2: RWRegister<u32>,
/// Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK.
pub OAR1: RWRegister<u32>,
/// Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK.
pub OAR2: RWRegister<u32>,
/// Access: No wait states
pub TIMINGR: RWRegister<u32>,
/// Access: No wait states, except if a write access occurs while a write access to this register is ongoing. In this case, wait states are inserted in the second write access until the previous one is completed. The latency of the second write access can be up to 2 x PCLK1 + 6 x I2CCLK.
pub TIMEOUTR: RWRegister<u32>,
/// Access: No wait states
pub ISR: RWRegister<u32>,
/// Access: No wait states
pub ICR: WORegister<u32>,
/// Access: No wait states
pub PECR: RORegister<u32>,
/// Access: No wait states
pub RXDR: RORegister<u32>,
/// Access: No wait states
pub TXDR: RWRegister<u32>,
}
pub struct ResetValues {
pub CR1: u32,
pub CR2: u32,
pub OAR1: u32,
pub OAR2: u32,
pub TIMINGR: u32,
pub TIMEOUTR: u32,
pub ISR: u32,
pub ICR: u32,
pub PECR: u32,
pub RXDR: u32,
pub TXDR: u32,
}
#[cfg(not(feature = "nosync"))]
pub struct Instance {
pub(crate) addr: u32,
pub(crate) _marker: PhantomData<*const RegisterBlock>,
}
#[cfg(not(feature = "nosync"))]
impl ::core::ops::Deref for Instance {
type Target = RegisterBlock;
#[inline(always)]
fn deref(&self) -> &RegisterBlock {
unsafe { &*(self.addr as *const _) }
}
}
#[cfg(feature = "rtic")]
unsafe impl Send for Instance {}