MODSERIAL with support for more devices - Added target NUCLEO_F103RB

Committer:
riaancillie
Date:
Sun May 05 14:57:11 2019 +0000
Revision:
46:d2a5e26fd658
Added support for target NUCLEO_F103RB

Who changed what in which revision?

UserRevisionLine numberNew contents of line
riaancillie 46:d2a5e26fd658 1 #if defined(TARGET_NUCLEO_F103RB)
riaancillie 46:d2a5e26fd658 2
riaancillie 46:d2a5e26fd658 3 #define MODSERIAL_IRQ_REG ((USART_TypeDef*)_base)->CR1
riaancillie 46:d2a5e26fd658 4 #define DISABLE_TX_IRQ MODSERIAL_IRQ_REG &= ~USART_CR1_TXEIE
riaancillie 46:d2a5e26fd658 5 #define DISABLE_RX_IRQ MODSERIAL_IRQ_REG &= ~USART_CR1_RXNEIE
riaancillie 46:d2a5e26fd658 6 #define ENABLE_TX_IRQ MODSERIAL_IRQ_REG |= USART_CR1_TXEIE
riaancillie 46:d2a5e26fd658 7 #define ENABLE_RX_IRQ MODSERIAL_IRQ_REG |= USART_CR1_RXNEIE
riaancillie 46:d2a5e26fd658 8
riaancillie 46:d2a5e26fd658 9 #define MODSERIAL_READ_REG ((USART_TypeDef*)_base)->DR
riaancillie 46:d2a5e26fd658 10 #define MODSERIAL_WRITE_REG ((USART_TypeDef*)_base)->DR
riaancillie 46:d2a5e26fd658 11 #define MODSERIAL_READABLE ((((USART_TypeDef*)_base)->SR & USART_SR_RXNE) != 0)
riaancillie 46:d2a5e26fd658 12 #define MODSERIAL_WRITABLE ((((USART_TypeDef*)_base)->SR & USART_SR_TXE) != 0)
riaancillie 46:d2a5e26fd658 13
riaancillie 46:d2a5e26fd658 14 #define RESET_TX_FIFO while(0 == 1)
riaancillie 46:d2a5e26fd658 15 #define RESET_RX_FIFO while(MODSERIAL_READABLE) char dummy = MODSERIAL_READ_REG
riaancillie 46:d2a5e26fd658 16
riaancillie 46:d2a5e26fd658 17 #define RX_IRQ_ENABLED ((MODSERIAL_IRQ_REG & USART_CR1_RXNEIE) != 0)
riaancillie 46:d2a5e26fd658 18 #define TX_IRQ_ENABLED ((MODSERIAL_IRQ_REG & USART_CR1_TXEIE) != 0)
riaancillie 46:d2a5e26fd658 19
riaancillie 46:d2a5e26fd658 20 #endif