Dependents:   Autoflight2018_22_MODSERIAL

Fork of MODSERIAL by Erik -

Committer:
Gary Servin
Date:
Tue Nov 17 12:11:44 2015 -0300
Revision:
41:d8422efe4761
Add Support for Inforce's mbed PAC shield (based on the STM32F401RB)

Who changed what in which revision?

UserRevisionLine numberNew 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