Skip to content

Commit 3d04d40

Browse files
committed
Added proper interrupt reset for F7 uart
1 parent 0c32dae commit 3d04d40

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

include/unicore-mx/stm32/f7/usart.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,21 @@ LGPL License Terms @ref lgpl_license
313313
/* EIE: Error interrupt enable */
314314
#define USART_CR3_EIE (1 << 0)
315315

316-
/* --- USART_GTPR values --------------------------------------------------- */
317-
318-
316+
/* --- USART_ICR values --------------------------------------------------- */
317+
#define USART_ICR_PECF (1 << 0)
318+
#define USART_ICR_FFECF (1 << 1)
319+
#define USART_ICR_NCF (1 << 2)
320+
#define USART_ICR_ORECF (1 << 3)
321+
#define USART_ICR_IDLECF (1 << 4)
322+
#define USART_ICR_TCCF (1 << 6)
323+
#define USART_ICR_LBDCF (1 << 8)
324+
#define USART_ICR_CTSCF (1 << 9)
325+
#define USART_ICR_RTOCF (1 << 11)
326+
#define USART_ICR_EOBCF (1 << 12)
327+
#define USART_ICR_CMCF (1 << 17)
328+
329+
void usart_clear_rx_interrupt(uint32_t usart_base);
330+
void usart_clear_tx_interrupt(uint32_t usart_base);
319331

320332
#endif
321333

lib/stm32/f7/usart_f7.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,14 @@ bool usart_get_interrupt_source(uint32_t usart, uint32_t flag)
171171
return false;
172172
}
173173

174+
void usart_clear_tx_interrupt(uint32_t usart_base)
175+
{
176+
USART_ICR(usart_base) |= USART_ICR_TCCF;
177+
}
178+
179+
void usart_clear_rx_interrupt(uint32_t usart_base)
180+
{
181+
USART_ICR(usart_base) |= USART_ICR_ORECF;
182+
}
183+
174184
/**@}*/

0 commit comments

Comments
 (0)