MODSERIAL with support for more devices

Dependents:   1D-Pong BMT-K9_encoder BMT-K9-Regelaar programma_filter ... more

Check the cookbook page for more information: https://mbed.org/cookbook/MODSERIAL

Did you add a device? Please send a pull request so we can keep everything in one library instead of many copies. In that case also send a PM, since currently mbed does not inform of new pull requests. I will then also add you to the developers of this library so you can do other changes directly.

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 #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