Open RTS
Full implementation of the Somfy RTS protocol
|
Simulates a physical RTS remote control. More...
#include <RTSRemote.hpp>
Inherits rts_remote.
Public Member Functions | |
RTSRemote (RTSPulseOutput *output, RTSRemoteStore *store=nullptr, rts_timings *timings=RTS_TIMINGS_DEFAULT) | |
Construct a RTSRemote instance. | |
void | sendCommand (uint32_t address, rts_command command, bool repeated=false) |
Send a "button press" command. | |
void | sendFrame (RTSFrame *frame, bool repeated=false) |
Send an RTS frame. | |
void | sendPulse (bool state, uint32_t micros) |
Send a single pulse to the internal RTSPulseOutput. | |
Additional Inherited Members | |
Related Symbols inherited from rts_remote | |
void | rts_remote_init (struct rts_remote *remote, struct rts_pulse_output *pulse_output, struct rts_remote_store *remote_store, struct rts_timings *timings) |
Initialize the rts_remote struct. | |
void | rts_remote_send_command (struct rts_remote *remote, uint32_t address, enum rts_command command, bool repeated) |
Send a "button press" command. | |
void | rts_remote_send_frame (struct rts_remote *remote, struct rts_frame *frame, bool repeated) |
Send an RTS frame. | |
void | rts_remote_send_pulse (struct rts_remote *remote, bool state, uint32_t micros) |
Send a single pulse to the internal rts_pulse_output. | |
Simulates a physical RTS remote control.
It takes RTS commands (button presses), converts them into a series of pulses, then outputs those pulses to a RTSPulseOutput (eg. a GPIO or radio).
Remote rolling codes can be persisted by providing a rts_remote_store backend (eg. ESP32's non-volatile storage, or Arduino's EEPROM).
RTSRemote::RTSRemote | ( | RTSPulseOutput * | output, |
RTSRemoteStore * | store = nullptr , |
||
rts_timings * | timings = RTS_TIMINGS_DEFAULT |
||
) |
Construct a RTSRemote instance.
output | where to send pulses to |
store | where to get/set remote rolling codes |
timings | the rts_timings struct to use for pulse encoding |
void RTSRemote::sendCommand | ( | uint32_t | address, |
rts_command | command, | ||
bool | repeated = false |
||
) |
Send a "button press" command.
This is the simplest way to use an RTSRemote, which automatically creates an RTSFrame struct under the hood, and handles the incrementing of rolling codes in the internal RTSRemoteStore.
The generated RTSFrame is passed to RTSRemote::sendFrame.
address | the remote address to send from |
command | the rts command to send (see rts_command enum) |
repeated | is this a "repeated" command, eg. from a button being held down? If so we won't increment the remote's rolling code |
void RTSRemote::sendFrame | ( | RTSFrame * | frame, |
bool | repeated = false |
||
) |
Send an RTS frame.
This function converts the provided RTSFrame into a series of pulses, which are passed along to the internal RTSPulseOutput by RTSRemote::sendPulse.
frame | the rts_frame to send |
repeated | is this a "repeated" command, eg. from a button being held down? If so we won't increment the remote's rolling code |
void RTSRemote::sendPulse | ( | bool | state, |
uint32_t | micros | ||
) |
Send a single pulse to the internal RTSPulseOutput.
state | boolean pulse logic state, true = HIGH, false = LOW |
micros | how long to set the pulse to this state, in microseconds |