IRrc
|
Low level infa-red output modulator, compatible with a number of infra-red controlled toys This is an abstract class that must be subclassed. Subclasses customise timings etc for particular toys and protocols. More...
#include <IRrc.h>
Public Member Functions | |
IRrc () | |
Constructor. | |
void | sendMessage (const uint8_t *msg, uint8_t len) |
void | sendPreamble () |
void | sendPostamble () |
Send the postamble which consists by default of a single One bit sent with sendOne() | |
void | sendZero () |
void | sendOne () |
void | enableCarrier () |
void | disableCarrier () |
void | carrierOn (uint16_t time) |
void | carrierOff (uint16_t time) |
Protected Attributes | |
uint16_t | _carrierFrequency |
IR Carrier frequence in Hertz. | |
uint16_t | _preamble |
Length of the preamble carrier on time in microseconds. | |
uint16_t | _preambleGap |
Length of the preamble gap off time in microseconds. | |
uint16_t | _zeroOnTime |
Time that the carrier is on at the start of a Zero bit in microseconds. | |
uint16_t | _zeroOffTime |
Time that the carrier is off at the end of a Zero bit in microseconds. | |
uint16_t | _oneOnTime |
Time that the carrier is on at the start of a One bit in microseconds. | |
uint16_t | _oneOffTime |
Time that the carrier is off at the end of a One bit in microseconds. |
Low level infa-red output modulator, compatible with a number of infra-red controlled toys This is an abstract class that must be subclassed. Subclasses customise timings etc for particular toys and protocols.
void IRrc::carrierOff | ( | uint16_t | time | ) |
Turns the carrier off for the specified time. Blocks until complete.
[in] | time |
Referenced by sendOne(), sendPreamble(), and sendZero().
void IRrc::carrierOn | ( | uint16_t | time | ) |
Turns the carrier on for the specified time. Blocks until complete.
[in] | time | Time on in microseconds |
Referenced by sendOne(), sendPreamble(), and sendZero().
void IRrc::disableCarrier | ( | ) |
Disables the IR output, if necessary. The default implmentation does nothing.
void IRrc::enableCarrier | ( | ) |
Enables IR output. The _carrierFrequency value controls the carrier frequency in Hertz. The IR output will be on pin 3 (OC2B) on most platforms, pin 9 on Arduino Mega.
References _carrierFrequency.
Referenced by sendMessage().
void IRrc::sendMessage | ( | const uint8_t * | msg, |
uint8_t | len | ||
) |
Sends the message pointed to by msg, with length len octets. Message is precended by the preamble with sendPreamble() and followed by the postamble with sendPostamble(). Each bit in the message is sent with the carrier enabled for the on time and disabled for the off time. Each octet is sent most significant bit first. Caution: this call blocks until the postamble has been sent
[in] | msg | Pointer to the octets to be sent |
[in] | len | Message length in octets |
References enableCarrier(), sendOne(), sendPostamble(), sendPreamble(), and sendZero().
Referenced by IRheli::sendCurrentCommand().
void IRrc::sendOne | ( | ) |
Encodes and sends a One bit, with the carrier on for _oneOnTime microseconds, followed by off for _oneOffTime microseconds.
References _oneOffTime, _oneOnTime, carrierOff(), and carrierOn().
Referenced by sendMessage(), and sendPostamble().
void IRrc::sendPreamble | ( | ) |
Sends the preamble, which consists of the carrier on for the _preamble time, followed by carrier off for the _preambleGap time.
References _preamble, _preambleGap, carrierOff(), and carrierOn().
Referenced by sendMessage().
void IRrc::sendZero | ( | ) |
Encodes and sends a Zero bit, with the carrier on for _zeroOnTime microseconds, followed by off for _zeroOffTime microseconds.
References _zeroOffTime, _zeroOnTime, carrierOff(), and carrierOn().
Referenced by sendMessage().