@@ -60,11 +60,11 @@ pub enum Error {
6060}
6161
6262/// UART interrupt events
63+ #[ cfg( feature = "uart_v2" ) ]
6364#[ enumflags2:: bitflags]
6465#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
6566#[ derive( Debug , Eq , PartialEq , Copy , Clone ) ]
66- #[ cfg_attr( feature = "f4" , repr( u16 ) ) ]
67- #[ cfg_attr( feature = "f7" , repr( u32 ) ) ]
67+ #[ repr( u16 ) ]
6868pub enum Event {
6969 /// IDLE interrupt enable
7070 Idle = 1 << 4 ,
@@ -78,12 +78,64 @@ pub enum Event {
7878 ParityError = 1 << 8 ,
7979}
8080
81+ /// UART interrupt events
82+ #[ cfg( feature = "uart_v3" ) ]
83+ #[ enumflags2:: bitflags]
84+ #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
85+ #[ derive( Debug , Eq , PartialEq , Copy , Clone ) ]
86+ #[ repr( u32 ) ]
87+ pub enum Event {
88+ /// IDLE interrupt enable
89+ Idle = 1 << 4 ,
90+ /// RXNE interrupt enable
91+ RxNotEmpty = 1 << 5 ,
92+ /// Transmission complete interrupt enable
93+ TransmissionComplete = 1 << 6 ,
94+ /// TXE interrupt enable
95+ TxEmpty = 1 << 7 ,
96+ /// PE interrupt enable
97+ ParityError = 1 << 8 ,
98+ /// Character match interrupt enable
99+ CharacterMatch = 1 << 14 ,
100+ /// End of Block interrupt enable
101+ EndOfBlock = 1 << 27 ,
102+ }
103+
104+ /// UART/USART status flags
105+ #[ cfg( feature = "uart_v2" ) ]
106+ #[ enumflags2:: bitflags]
107+ #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
108+ #[ derive( Debug , Eq , PartialEq , Copy , Clone ) ]
109+ #[ repr( u16 ) ]
110+ pub enum Flag {
111+ /// Parity error
112+ ParityError = 1 << 0 ,
113+ /// Framing error
114+ FramingError = 1 << 1 ,
115+ /// Noise detected flag
116+ Noise = 1 << 2 ,
117+ /// Overrun error
118+ Overrun = 1 << 3 ,
119+ /// IDLE line detected
120+ Idle = 1 << 4 ,
121+ /// Read data register not empty
122+ RxNotEmpty = 1 << 5 ,
123+ /// Transmission complete
124+ TransmissionComplete = 1 << 6 ,
125+ /// Transmit data register empty
126+ TxEmpty = 1 << 7 ,
127+ /// LIN break detection flag
128+ LinBreak = 1 << 8 ,
129+ /// CTS flag
130+ CtsInterrupt = 1 << 9 ,
131+ }
132+
81133/// UART/USART status flags
82134#[ enumflags2:: bitflags]
135+ #[ cfg( feature = "uart_v3" ) ]
83136#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
84137#[ derive( Debug , Eq , PartialEq , Copy , Clone ) ]
85- #[ cfg_attr( feature = "f4" , repr( u16 ) ) ]
86- #[ cfg_attr( feature = "f7" , repr( u32 ) ) ]
138+ #[ repr( u32 ) ]
87139pub enum Flag {
88140 /// Parity error
89141 ParityError = 1 << 0 ,
@@ -103,16 +155,36 @@ pub enum Flag {
103155 TxEmpty = 1 << 7 ,
104156 /// LIN break detection flag
105157 LinBreak = 1 << 8 ,
158+ /// CTS interrupt
159+ CtsInterrupt = 1 << 9 ,
106160 /// CTS flag
107- Cts = 1 << 9 ,
161+ CtsStatus = 1 << 10 ,
162+ /// Receiver timeout
163+ ReceiverTimeout = 1 << 11 ,
164+ /// End of block
165+ EndOfBlock = 1 << 12 ,
166+ /// Auto baud rate error
167+ AutoBaudRateError = 1 << 14 ,
168+ /// Auto baud rate
169+ AutoBaudRateFlag = 1 << 15 ,
170+ /// Busy flag
171+ Busy = 1 << 16 ,
172+ /// Character match
173+ CharacterMatch = 1 << 17 ,
174+ /// Send break
175+ SendBreak = 1 << 18 ,
176+ /// Receiver wakeup from Mute mode
177+ ReceiverWakeup = 1 << 19 ,
178+ /// Transmit enable acknowledge
179+ TransmitEnableAck = 1 << 21 ,
108180}
109181
110182/// UART clearable flags
183+ #[ cfg( feature = "uart_v2" ) ]
111184#[ enumflags2:: bitflags]
112185#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
113186#[ derive( Debug , Eq , PartialEq , Copy , Clone ) ]
114- #[ cfg_attr( feature = "f4" , repr( u16 ) ) ]
115- #[ cfg_attr( feature = "f7" , repr( u32 ) ) ]
187+ #[ repr( u16 ) ]
116188pub enum CFlag {
117189 /// Read data register not empty
118190 RxNotEmpty = 1 << 5 ,
@@ -122,6 +194,37 @@ pub enum CFlag {
122194 LinBreak = 1 << 8 ,
123195}
124196
197+ /// UART clearable flags
198+ #[ cfg( feature = "uart_v3" ) ]
199+ #[ enumflags2:: bitflags]
200+ #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
201+ #[ derive( Debug , Eq , PartialEq , Copy , Clone ) ]
202+ #[ repr( u32 ) ]
203+ pub enum CFlag {
204+ /// Parity error
205+ ParityError = 1 << 0 ,
206+ /// Framing error
207+ FramingError = 1 << 1 ,
208+ /// Noise detected
209+ Noise = 1 << 2 ,
210+ /// Overrun error
211+ Overrun = 1 << 3 ,
212+ /// Idle line detected
213+ Idle = 1 << 4 ,
214+ /// Transmission complete
215+ TransmissionComplete = 1 << 6 ,
216+ /// LIN break detection flag
217+ LinBreak = 1 << 8 ,
218+ /// CTS interrupt
219+ CtsInterrupt = 1 << 9 ,
220+ /// Receiver timeout
221+ ReceiverTimeout = 1 << 11 ,
222+ /// End of block
223+ EndOfBlock = 1 << 12 ,
224+ /// Character match
225+ CharacterMatch = 1 << 17 ,
226+ }
227+
125228pub mod config;
126229
127230pub use config:: Config ;
0 commit comments