Not work original Lib on F446RE & L432KC . Change usage prime() & setNext() for both TX and RX function due to unexpected behavior (maybe os TimerEvent function problem)
Dependents: BufferedSoftSerial
SoftSerial.cpp
00001 // Modified by K.Arai / JH1PJL May 12th, 2020 00002 00003 #include "SoftSerial.h" 00004 00005 SoftSerial::SoftSerial(PinName TX, PinName RX, const char* name) 00006 { 00007 tx_en = rx_en = false; 00008 read_buffer = 0; 00009 if (TX != NC) { 00010 tx = new DigitalOut(TX); 00011 tx_en = true; 00012 tx->write(1); 00013 tx_bit = -1; 00014 txticker.attach(this, &SoftSerial::tx_handler); 00015 } 00016 if (RX != NC) { 00017 rx = new InterruptIn(RX); 00018 rx_en = true; 00019 out_valid = false; 00020 rxticker.attach(this, &SoftSerial::rx_handler); 00021 rx->fall(callback(this, &SoftSerial::rx_gpio_irq_handler)); 00022 } 00023 00024 baud(9600); 00025 format(); 00026 } 00027 00028 SoftSerial::~SoftSerial() 00029 { 00030 if (tx_en) { 00031 delete(tx); 00032 } 00033 if (rx_en) { 00034 delete(rx); 00035 } 00036 } 00037 00038 void SoftSerial::baud(int baudrate) 00039 { 00040 bit_period = 1000000 / baudrate; 00041 } 00042 00043 void SoftSerial::format(int bits, Parity parity, int stop_bits) 00044 { 00045 _bits = bits; 00046 _parity = parity; 00047 _stop_bits = stop_bits; 00048 _total_bits = 2 + _bits + _stop_bits + (bool)_parity; 00049 }
Generated on Thu Jul 21 2022 01:12:39 by
![doxygen](doxygen.png)