RoemoteIR
Diff: TransmitterIR.cpp
- Revision:
- 11:268cc2ab63bd
- Parent:
- 10:c54fb1204d1e
diff -r c54fb1204d1e -r 268cc2ab63bd TransmitterIR.cpp --- a/TransmitterIR.cpp Fri Sep 17 21:44:01 2010 +0000 +++ b/TransmitterIR.cpp Mon Sep 20 00:54:59 2010 +0000 @@ -10,6 +10,11 @@ #define LOCK() #define UNLOCK() +/** + * Constructor. + * + * @param txpin Pin for transmit IR signal. + */ TransmitterIR::TransmitterIR(PinName txpin) : tx(txpin) { tx.write(0.0); tx.period_us(26.3); @@ -24,9 +29,17 @@ data.bitlength = 0; } +/** + * Destructor. + */ TransmitterIR::~TransmitterIR() { } +/** + * Get state. + * + * @return Current state. + */ TransmitterIR::State TransmitterIR::getState(void) { LOCK(); State s = work.state; @@ -34,6 +47,15 @@ return s; } +/** + * Set data. + * + * @param format Format. + * @param buf Buffer of a data. + * @param bitlength Bit length of the data. + * + * @return Data bit length. + */ int TransmitterIR::setData(RemoteIR::Format format, uint8_t *buf, int bitlength) { LOCK(); if (work.state != Idle) { @@ -57,15 +79,15 @@ switch (format) { case RemoteIR::NEC: ticker.detach(); - ticker.attach_us(this, &TransmitterIR::tick, TUS_NEC); + ticker.attach_us(this, &TransmitterIR::tick, RemoteIR::TUS_NEC); break; case RemoteIR::AEHA: ticker.detach(); - ticker.attach_us(this, &TransmitterIR::tick, TUS_AEHA); + ticker.attach_us(this, &TransmitterIR::tick, RemoteIR::TUS_AEHA); break; case RemoteIR::SONY: ticker.detach(); - ticker.attach_us(this, &TransmitterIR::tick, TUS_SONY); + ticker.attach_us(this, &TransmitterIR::tick, RemoteIR::TUS_SONY); break; } @@ -241,7 +263,7 @@ * AEHA. */ static const int TRAILER_AEHA_HEAD = 1; - static const int TRAILER_AEHA_TAIL = 8000 / TUS_AEHA; + static const int TRAILER_AEHA_TAIL = 8000 / RemoteIR::TUS_AEHA; if (work.trailer < TRAILER_AEHA_HEAD) { tx.write(0.5); } else {