MODSERIAL with support for more devices - Added target NUCLEO_F103RB
Device/MODSERIALNUCLEO_F103RB.cpp@46:d2a5e26fd658, 2019-05-05 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
riaancillie | 46:d2a5e26fd658 | 1 | #ifdef TARGET_NUCLEO_F103RB |
riaancillie | 46:d2a5e26fd658 | 2 | #include "MODSERIAL.h" |
riaancillie | 46:d2a5e26fd658 | 3 | |
riaancillie | 46:d2a5e26fd658 | 4 | void MODSERIAL::setBase(void ) { |
riaancillie | 46:d2a5e26fd658 | 5 | #if DEVICE_SERIAL_ASYNCH |
riaancillie | 46:d2a5e26fd658 | 6 | switch( _serial.serial.index ) { |
riaancillie | 46:d2a5e26fd658 | 7 | #else |
riaancillie | 46:d2a5e26fd658 | 8 | switch( _serial.index ) { |
riaancillie | 46:d2a5e26fd658 | 9 | #endif |
riaancillie | 46:d2a5e26fd658 | 10 | case 0: _base = USART1; _IRQ = USART1_IRQn; break; |
riaancillie | 46:d2a5e26fd658 | 11 | case 1: _base = USART2; _IRQ = USART2_IRQn; break; |
riaancillie | 46:d2a5e26fd658 | 12 | case 2: _base = USART3; _IRQ = USART3_IRQn; break; |
riaancillie | 46:d2a5e26fd658 | 13 | default: _base = NULL; _IRQ = (IRQn_Type)NULL; break; |
riaancillie | 46:d2a5e26fd658 | 14 | } |
riaancillie | 46:d2a5e26fd658 | 15 | } |
riaancillie | 46:d2a5e26fd658 | 16 | |
riaancillie | 46:d2a5e26fd658 | 17 | void MODSERIAL::initDevice(void) {}; |
riaancillie | 46:d2a5e26fd658 | 18 | |
riaancillie | 46:d2a5e26fd658 | 19 | bool MODSERIAL::txIsBusy( void ) |
riaancillie | 46:d2a5e26fd658 | 20 | { |
riaancillie | 46:d2a5e26fd658 | 21 | return ( (((USART_TypeDef*)_base)->SR & ( 1UL << 6 )) == 0 ) ? true : false; |
riaancillie | 46:d2a5e26fd658 | 22 | } |
riaancillie | 46:d2a5e26fd658 | 23 | |
riaancillie | 46:d2a5e26fd658 | 24 | #endif |