モータードライバとWi-FiモジュールESP-WROOM-02をmbed LPC1114FN28に繋げて、RCWControllerからコントロールするプログラム

Dependencies:   mbed

Committer:
jksoft
Date:
Fri Jul 22 05:36:02 2016 +0000
Revision:
0:3c24a40c2343
??

Who changed what in which revision?

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