MODSERIAL with support for more devices
Fork of MODSERIAL by
Device/MODSERIAL_NUCLEO_L053R8.h@46:6571cd7f896e, 2018-07-11 (annotated)
- Committer:
- fahadmirza
- Date:
- Wed Jul 11 08:17:03 2018 +0000
- Revision:
- 46:6571cd7f896e
Added support for NUCLEO_L053R8
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fahadmirza | 46:6571cd7f896e | 1 | #if defined(TARGET_NUCLEO_L053R8) |
fahadmirza | 46:6571cd7f896e | 2 | |
fahadmirza | 46:6571cd7f896e | 3 | #define MODSERIAL_IRQ_REG ((USART_TypeDef*)_base)->CR1 |
fahadmirza | 46:6571cd7f896e | 4 | #define DISABLE_TX_IRQ MODSERIAL_IRQ_REG &= ~USART_CR1_TXEIE |
fahadmirza | 46:6571cd7f896e | 5 | #define DISABLE_RX_IRQ MODSERIAL_IRQ_REG &= ~USART_CR1_RXNEIE |
fahadmirza | 46:6571cd7f896e | 6 | #define ENABLE_TX_IRQ MODSERIAL_IRQ_REG |= USART_CR1_TXEIE |
fahadmirza | 46:6571cd7f896e | 7 | #define ENABLE_RX_IRQ MODSERIAL_IRQ_REG |= USART_CR1_RXNEIE |
fahadmirza | 46:6571cd7f896e | 8 | |
fahadmirza | 46:6571cd7f896e | 9 | #define MODSERIAL_READ_REG ((USART_TypeDef*)_base)->RDR |
fahadmirza | 46:6571cd7f896e | 10 | #define MODSERIAL_WRITE_REG ((USART_TypeDef*)_base)->TDR |
fahadmirza | 46:6571cd7f896e | 11 | #define MODSERIAL_READABLE ((((USART_TypeDef*)_base)->ISR & USART_ISR_RXNE) != 0) |
fahadmirza | 46:6571cd7f896e | 12 | #define MODSERIAL_WRITABLE ((((USART_TypeDef*)_base)->ISR & USART_ISR_TXE) != 0) |
fahadmirza | 46:6571cd7f896e | 13 | |
fahadmirza | 46:6571cd7f896e | 14 | #define RESET_TX_FIFO while(0 == 1) |
fahadmirza | 46:6571cd7f896e | 15 | #define RESET_RX_FIFO while(MODSERIAL_READABLE) char dummy = MODSERIAL_READ_REG |
fahadmirza | 46:6571cd7f896e | 16 | |
fahadmirza | 46:6571cd7f896e | 17 | #define RX_IRQ_ENABLED ((MODSERIAL_IRQ_REG & USART_CR1_RXNEIE) != 0) |
fahadmirza | 46:6571cd7f896e | 18 | #define TX_IRQ_ENABLED ((MODSERIAL_IRQ_REG & USART_CR1_TXEIE) != 0) |
fahadmirza | 46:6571cd7f896e | 19 | |
fahadmirza | 46:6571cd7f896e | 20 | #endif |