![](/media/cache/profiles/5f14615696649541a025d3d0f8e0447f.jpg.50x50_q85.jpg)
ワークショップ用に公開しているものです。
Fork of Arch_Analog_Thermistor_Blinker by
Diff: SoftSerialSendOnly/SoftSerialSendOnry.cpp
- Revision:
- 9:5a7dca00d87b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SoftSerialSendOnly/SoftSerialSendOnry.cpp Sat Feb 27 05:38:49 2016 +0000 @@ -0,0 +1,36 @@ +#include "SoftSerialSendOnry.h" + +SoftSerialSendOnry::SoftSerialSendOnry(PinName TX, const char* name) { + tx_en = false; + if (TX != NC) { + tx = new DigitalOut(TX); + tx_en = true; + tx->write(1); + tx_bit = -1; + txticker.attach(this, &SoftSerialSendOnry::tx_handler); + } + + baud(9600); + format(); +} + +SoftSerialSendOnry::~SoftSerialSendOnry() { + if (tx_en) + delete(tx); +} + +void SoftSerialSendOnry::baud(int baudrate) { + bit_period = 1000000 / baudrate; +} + +void SoftSerialSendOnry::format(int bits, Parity parity, int stop_bits) { + _bits = bits; + _parity = parity; + _stop_bits = stop_bits; + _total_bits = 1 + _bits + _stop_bits + (bool)_parity; +} + +int SoftSerialSendOnry::_getc() +{ + return(0); +} \ No newline at end of file