MODSERIAL with support for more devices
Fork of MODSERIAL by
Device/MODSERIAL_PAC_F401RB.h@45:da0788f0bd77, 2018-04-01 (annotated)
- Committer:
- rvasquez6089
- Date:
- Sun Apr 01 18:39:35 2018 +0000
- Revision:
- 45:da0788f0bd77
- Parent:
- 41:d8422efe4761
Added support for Nucleo F746ZG
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Gary Servin |
41:d8422efe4761 | 1 | #if defined(TARGET_PAC_F401RB) |
Gary Servin |
41:d8422efe4761 | 2 | |
Gary Servin |
41:d8422efe4761 | 3 | #define MODSERIAL_IRQ_REG ((USART_TypeDef*)_base)->CR1 |
Gary Servin |
41:d8422efe4761 | 4 | #define DISABLE_TX_IRQ MODSERIAL_IRQ_REG &= ~USART_CR1_TXEIE |
Gary Servin |
41:d8422efe4761 | 5 | #define DISABLE_RX_IRQ MODSERIAL_IRQ_REG &= ~USART_CR1_RXNEIE |
Gary Servin |
41:d8422efe4761 | 6 | #define ENABLE_TX_IRQ MODSERIAL_IRQ_REG |= USART_CR1_TXEIE |
Gary Servin |
41:d8422efe4761 | 7 | #define ENABLE_RX_IRQ MODSERIAL_IRQ_REG |= USART_CR1_RXNEIE |
Gary Servin |
41:d8422efe4761 | 8 | |
Gary Servin |
41:d8422efe4761 | 9 | #define MODSERIAL_READ_REG ((USART_TypeDef*)_base)->DR |
Gary Servin |
41:d8422efe4761 | 10 | #define MODSERIAL_WRITE_REG ((USART_TypeDef*)_base)->DR |
Gary Servin |
41:d8422efe4761 | 11 | #define MODSERIAL_READABLE ((((USART_TypeDef*)_base)->SR & USART_SR_RXNE) != 0) |
Gary Servin |
41:d8422efe4761 | 12 | #define MODSERIAL_WRITABLE ((((USART_TypeDef*)_base)->SR & USART_SR_TXE) != 0) |
Gary Servin |
41:d8422efe4761 | 13 | |
Gary Servin |
41:d8422efe4761 | 14 | #define RESET_TX_FIFO while(0 == 1) |
Gary Servin |
41:d8422efe4761 | 15 | #define RESET_RX_FIFO while(MODSERIAL_READABLE) char dummy = MODSERIAL_READ_REG |
Gary Servin |
41:d8422efe4761 | 16 | |
Gary Servin |
41:d8422efe4761 | 17 | #define RX_IRQ_ENABLED ((MODSERIAL_IRQ_REG & USART_CR1_RXNEIE) != 0) |
Gary Servin |
41:d8422efe4761 | 18 | #define TX_IRQ_ENABLED ((MODSERIAL_IRQ_REG & USART_CR1_TXEIE) != 0) |
Gary Servin |
41:d8422efe4761 | 19 | |
Gary Servin |
41:d8422efe4761 | 20 | #endif |