smple

Dependencies:   ESP8266Interface IFTTT mbed

Fork of IFTTT_ESP8266_Example by Austin Blackstone

Committer:
jksoft
Date:
Mon Jul 27 11:43:18 2015 +0000
Revision:
4:3994cd534bd5
rev0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 4:3994cd534bd5 1 #include "SoftSerialSendOnry.h"
jksoft 4:3994cd534bd5 2
jksoft 4:3994cd534bd5 3 SoftSerialSendOnry::SoftSerialSendOnry(PinName TX, const char* name) {
jksoft 4:3994cd534bd5 4 tx_en = false;
jksoft 4:3994cd534bd5 5 if (TX != NC) {
jksoft 4:3994cd534bd5 6 tx = new DigitalOut(TX);
jksoft 4:3994cd534bd5 7 tx_en = true;
jksoft 4:3994cd534bd5 8 tx->write(1);
jksoft 4:3994cd534bd5 9 tx_bit = -1;
jksoft 4:3994cd534bd5 10 txticker.attach(this, &SoftSerialSendOnry::tx_handler);
jksoft 4:3994cd534bd5 11 }
jksoft 4:3994cd534bd5 12
jksoft 4:3994cd534bd5 13 baud(9600);
jksoft 4:3994cd534bd5 14 format();
jksoft 4:3994cd534bd5 15 }
jksoft 4:3994cd534bd5 16
jksoft 4:3994cd534bd5 17 SoftSerialSendOnry::~SoftSerialSendOnry() {
jksoft 4:3994cd534bd5 18 if (tx_en)
jksoft 4:3994cd534bd5 19 delete(tx);
jksoft 4:3994cd534bd5 20 }
jksoft 4:3994cd534bd5 21
jksoft 4:3994cd534bd5 22 void SoftSerialSendOnry::baud(int baudrate) {
jksoft 4:3994cd534bd5 23 bit_period = 1000000 / baudrate;
jksoft 4:3994cd534bd5 24 }
jksoft 4:3994cd534bd5 25
jksoft 4:3994cd534bd5 26 void SoftSerialSendOnry::format(int bits, Parity parity, int stop_bits) {
jksoft 4:3994cd534bd5 27 _bits = bits;
jksoft 4:3994cd534bd5 28 _parity = parity;
jksoft 4:3994cd534bd5 29 _stop_bits = stop_bits;
jksoft 4:3994cd534bd5 30 _total_bits = 1 + _bits + _stop_bits + (bool)_parity;
jksoft 4:3994cd534bd5 31 }
jksoft 4:3994cd534bd5 32
jksoft 4:3994cd534bd5 33 int SoftSerialSendOnry::_getc()
jksoft 4:3994cd534bd5 34 {
jksoft 4:3994cd534bd5 35 return(0);
jksoft 4:3994cd534bd5 36 }