Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MilkcocoaSample MilkcocoaSampleESP8266_LED MilkcocoaSampleESP8266 MilkcocoaSample_3G ... more
SoftSerialSendOnly/SoftSerialSendOnry.cpp
- Committer:
- jksoft
- Date:
- 2015-12-15
- Revision:
- 0:23e533c4b1ec
File content as of revision 0:23e533c4b1ec:
#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);
}
Milkcocoa