Open RTS
Full implementation of the Somfy RTS protocol
Loading...
Searching...
No Matches
Open RTS C Library

Core C library. More...

Data Structures

struct  rts_frame
 Represents the message "payload" sent by RTS remote controls. More...
 
struct  rts_frame_builder
 Assembles pulses received via rts_frame_builder_handle_pulse, into a complete rts_frame, and delivers them to the user-provided callback. More...
 
struct  rts_pulse_output
 Provides an interface for an output of RTS pulses, eg a GPIO or radio. More...
 
struct  rts_pulse_source
 Provides an interface for a source of RTS pulses, eg a GPIO or radio. More...
 
struct  rts_radio
 Abstraction layer which configures radio modules for RTS. More...
 
struct  rts_receiver
 Simulates a physical RTS receiver device, such as a shade or drapery motor. More...
 
struct  rts_remote
 Simulates a physical RTS remote control. More...
 
struct  rts_remote_store
 Provides an interface for a datastore which contains details about remote controls and rolling codes. More...
 
struct  rts_timings
 Timing definitions for encoding and decoding frames to pulses. More...
 

Enumerations

enum  rts_command {
  RTS_COMMAND_MY = 0x1 ,
  RTS_COMMAND_UP = 0x2 ,
  RTS_COMMAND_MY_UP = 0x3 ,
  RTS_COMMAND_DOWN = 0x4 ,
  RTS_COMMAND_MY_DOWN = 0x5 ,
  RTS_COMMAND_UP_DOWN = 0x6 ,
  RTS_COMMAND_MY_UP_DOWN = 0x7 ,
  RTS_COMMAND_PROG = 0x8 ,
  RTS_COMMAND_SUN_FLAG = 0x9 ,
  RTS_COMMAND_FLAG = 0xA
}
 Command sent by a remote, or received by a receiver as part of an rts_frame event. More...
 
enum  rts_radio_mode {
  RTS_RADIO_MODE_STANDBY ,
  RTS_RADIO_MODE_RECEIVE ,
  RTS_RADIO_MODE_TRANSMIT
}
 The transceiver mode to enter. More...
 
enum  rts_receiver_event {
  RTS_RECEIVER_EVENT_NONE ,
  RTS_RECEIVER_EVENT_PRESS ,
  RTS_RECEIVER_EVENT_HOLD ,
  RTS_RECEIVER_EVENT_HOLD_2 ,
  RTS_RECEIVER_EVENT_HOLD_3
}
 De-duplicated "frame" events. More...
 
enum  rts_receiver_mode {
  RTS_RECEIVER_MODE_OFF ,
  RTS_RECEIVER_MODE_PROGRAMMING ,
  RTS_RECEIVER_MODE_COMMAND
}
 Receiver modes. More...
 

Functions

const char * rts_command_to_string (enum rts_command command)
 Get a string representation of the given rts_command.
 
void rts_pulse_output_init_espidf_gpio (struct rts_pulse_output *pulse_output, uint8_t data_pin)
 Initialize an rts_pulse_output which sends pulses to the specified ESP-IDF GPIO pin.
 
void rts_pulse_source_init_espidf_gpio (struct rts_pulse_source *pulse_source, uint8_t data_pin)
 Initialize an rts_pulse_source which receives pulses from the specified ESP-IDF GPIO pin.
 
void rts_remote_store_init_nvs (struct rts_remote_store *store)
 Initialize an rts_remote_store which stores remotes and rolling codes in ESP-IDF's NVS (Non-volatile storage) on ESP8266 and ESP32 devices.
 
void rts_pulse_output_init_gpiod (struct rts_pulse_output *pulse_output, char *device, uint8_t data_pin)
 Initialize an rts_pulse_output which sends pulses to the specified Linux gpiod device.
 
void rts_pulse_source_init_gpiod (struct rts_pulse_source *pulse_source, char *device, uint8_t data_pin)
 Initialize an rts_pulse_source which receives pulses from the specified Linux gpiod device.
 
void rts_remote_store_init_mmap (struct rts_remote_store *store, const char *filename)
 Initialize an rts_remote_store which stores remotes and rolling codes in a memory-mapped file on POSIX systems.
 
void rts_frame_init (struct rts_frame *frame, enum rts_command command, uint16_t rolling_code, uint32_t remote_address)
 Initialize an rts_frame with typical payload.
 
void rts_frame_from_bytes (struct rts_frame *frame, const uint8_t *bytes)
 Initialize an rts_frame from the raw (deobfuscated) bytes received.
 
void rts_frame_to_bytes (struct rts_frame *frame, uint8_t *bytes, bool obfuscate)
 Convert an rts_frame to byte representation, and optionally apply XOR obfuscation to make it ready to send.
 
void rts_frame_obfuscate_bytes (uint8_t *bytes)
 Apply in-place XOR obfuscation to a raw byte array representation of a frame.
 
void rts_frame_deobfuscate_bytes (uint8_t *dest, const uint8_t *src)
 Apply XOR deobfuscation to a raw byte array representation of a frame.
 
uint8_t rts_frame_generate_checksum (const uint8_t *bytes)
 Generate a checksum for the raw (deobfuscated) bytes of a frame.
 
void rts_frame_builder_init (struct rts_frame_builder *builder, struct rts_timings *timings)
 Initialize an rts_frame_builder with the specified timings.
 
void rts_frame_builder_handle_pulse (struct rts_frame_builder *builder, bool state, uint32_t micros)
 Inform the frame builder about a new pulse.
 
void rts_frame_builder_set_callback (struct rts_frame_builder *builder, void(*callback)(struct rts_frame *frame, uint8_t count, uint32_t duration, void *user_data), void *user_data)
 Set a callback to call when new complete frames are received.
 
void rts_pulse_output_enable (struct rts_pulse_output *pulse_output)
 Enable the pulse output.
 
void rts_pulse_output_disable (struct rts_pulse_output *pulse_output)
 Disable the pulse output.
 
void rts_pulse_output_send_pulse (struct rts_pulse_output *pulse_output, bool state, uint32_t micros)
 Instruct the rts_pulse_output to output a pulse.
 
void rts_pulse_output_close (struct rts_pulse_output *pulse_output)
 Close and free resources allocated via a previous call to rts_pulse_output_init_*()
 
void rts_pulse_source_enable (struct rts_pulse_source *pulse_source)
 Enable the pulse source.
 
void rts_pulse_source_disable (struct rts_pulse_source *pulse_source)
 Disable the pulse source.
 
void rts_pulse_source_update (struct rts_pulse_source *pulse_source)
 Check for new pulse data, should be called every loop()
 
void rts_pulse_source_attach (struct rts_pulse_source *pulse_source, struct rts_frame_builder *frame_builder)
 Attach an observer.
 
void rts_pulse_source_close (struct rts_pulse_source *pulse_source)
 Close and free any resources allocated via a previous call to rts_pulse_source_init_*()
 
struct rfm69rts_radio_init_rfm69 (struct rts_radio *radio, struct spi_module *spi)
 Initialize an rts_radio to use an SX1231/RFM69 radio module.
 
struct sx1278rts_radio_init_sx1278 (struct rts_radio *radio, struct spi_module *spi)
 Initialize an rts_radio to use an SX1278/RFM96 radio module.
 
void rts_radio_set_mode (struct rts_radio *radio, enum rts_radio_mode mode)
 Set the radio mode for the specified rts_radio module, eg.
 
void rts_receiver_init (struct rts_receiver *receiver, struct rts_pulse_source *pulse_source, struct rts_remote_store *remote_store)
 Initialize an rts_receiver.
 
void rts_receiver_set_frame_callback (struct rts_receiver *receiver, void(*callback)(enum rts_receiver_event, struct rts_frame *frame, void *user_data), void *user_data)
 Set a callback function to call when new receiver events are received.
 
void rts_receiver_set_mode_callback (struct rts_receiver *receiver, void(*callback)(enum rts_receiver_mode, void *user_data), void *user_data)
 Set a callback function to call when the receiver mode changes.
 
void rts_receiver_set_mode (struct rts_receiver *receiver, uint8_t mode)
 Change the receiver mode.
 
void rts_receiver_forget_all_remotes (struct rts_receiver *receiver)
 Convenience function to forget all paired remotes by clearing the receiver's rts_remote_store.
 
void rts_receiver_update (struct rts_receiver *receiver)
 Instruct the receiver's rts_pulse_source to check for new pulse data, should be called every loop() if the pulse source does not keep itself updated (eg.
 
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.
 
void rts_remote_store_set_code (struct rts_remote_store *store, uint32_t remote_address, uint16_t rolling_code)
 Set the rolling code for this remote, create if doesn't exist.
 
uint16_t rts_remote_store_get_code (struct rts_remote_store *store, uint32_t remote_address)
 Get the rolling code for this remote.
 
uint16_t rts_remote_store_next_code (struct rts_remote_store *store, uint32_t remote_address)
 Get the rolling code for this remote, then increment and persist.
 
bool rts_remote_store_known_remote (struct rts_remote_store *store, uint32_t remote_address)
 Check if this is a known remote address.
 
void rts_remote_store_forget (struct rts_remote_store *store, uint32_t remote_address)
 Forget a specific remote.
 
void rts_remote_store_clear (struct rts_remote_store *store)
 Clear all remotes and rolling codes.
 
void rts_remote_store_close (struct rts_remote_store *store)
 Close and free any resources allocated via a previous call to rts_remote_store_init*()
 
void rts_remote_store_init_memory (struct rts_remote_store *store)
 Initialize an rts_remote_store which stores remotes and rolling codes in memory.
 

Variables

struct rts_timings RTS_TIMINGS_SITUO5
 Timings as measured from a physical Situio5 remote.
 
struct rts_timingsRTS_TIMINGS_DEFAULT
 Default timings, suitable for most application.
 

Detailed Description

Core C library.

Enumeration Type Documentation

◆ rts_command

Command sent by a remote, or received by a receiver as part of an rts_frame event.

Commands reflect buttons on a remote, eg "Up", "Down", "My", or certain combinations of button presses.

Enumerator
RTS_COMMAND_MY 

My/Stop button pressed.

RTS_COMMAND_UP 

Up button pressed.

RTS_COMMAND_MY_UP 

My and Up buttons both pressed.

RTS_COMMAND_DOWN 

Down button pressed.

RTS_COMMAND_MY_DOWN 

My and Down buttons both pressed.

RTS_COMMAND_UP_DOWN 

Up and Down buttons both pressed.

RTS_COMMAND_MY_UP_DOWN 

My, Up and Down buttons all pressed.

RTS_COMMAND_PROG 

Prog button pressed.

RTS_COMMAND_SUN_FLAG 

Sun and Flag button pressed (Soliris)

RTS_COMMAND_FLAG 

Flag button pressed (Soliris)

◆ rts_radio_mode

The transceiver mode to enter.

Enumerator
RTS_RADIO_MODE_STANDBY 

Standby mode.

RTS_RADIO_MODE_RECEIVE 

Receive mode.

RTS_RADIO_MODE_TRANSMIT 

Transmit mode.

◆ rts_receiver_event

De-duplicated "frame" events.

Enumerator
RTS_RECEIVER_EVENT_NONE 

No event detected.

RTS_RECEIVER_EVENT_PRESS 

"Press" event detected, fired on first frame

RTS_RECEIVER_EVENT_HOLD 

"Hold" event detected, fired after 2s of repeats

RTS_RECEIVER_EVENT_HOLD_2 

"2x Hold" event detected, fired after 4s of repeats

RTS_RECEIVER_EVENT_HOLD_3 

"3x Hold" event detected, fired after 6s of repeats

◆ rts_receiver_mode

Receiver modes.

Enumerator
RTS_RECEIVER_MODE_OFF 

The receiver is off, will not process events.

RTS_RECEIVER_MODE_PROGRAMMING 

The receiver is in programming mode.

RTS_RECEIVER_MODE_COMMAND 

The receiver is in command mode.

Function Documentation

◆ rts_command_to_string()

const char * rts_command_to_string ( enum rts_command  command)

Get a string representation of the given rts_command.

Parameters
commandthe rts_command to convert
Returns
const char* a string representation of the rts_command

◆ rts_pulse_output_init_espidf_gpio()

void rts_pulse_output_init_espidf_gpio ( struct rts_pulse_output pulse_output,
uint8_t  data_pin 
)
related

Initialize an rts_pulse_output which sends pulses to the specified ESP-IDF GPIO pin.

Note
Only available on ESP8266/ESP32 devices
Parameters
pulse_outputthe rts_pulse_output struct to initialize
data_pinthe GPIO pin number to output pulses to

◆ rts_pulse_source_init_espidf_gpio()

void rts_pulse_source_init_espidf_gpio ( struct rts_pulse_source pulse_source,
uint8_t  data_pin 
)
related

Initialize an rts_pulse_source which receives pulses from the specified ESP-IDF GPIO pin.

Note
Only available on ESP8266/ESP32 devices
Parameters
pulse_sourcethe rts_pulse_source struct to initialize
data_pinthe GPIO pin to monitor

◆ rts_remote_store_init_nvs()

void rts_remote_store_init_nvs ( struct rts_remote_store store)
related

Initialize an rts_remote_store which stores remotes and rolling codes in ESP-IDF's NVS (Non-volatile storage) on ESP8266 and ESP32 devices.

Note
Only available on ESP8266/ESP32 devices
Parameters
storethe rts_remote_store struct to initialize

◆ rts_pulse_output_init_gpiod()

void rts_pulse_output_init_gpiod ( struct rts_pulse_output pulse_output,
char *  device,
uint8_t  data_pin 
)
related

Initialize an rts_pulse_output which sends pulses to the specified Linux gpiod device.

Note
  • Can be enabled on Linux systems by defining the OPENRTS_HAS_GPIOD macro
  • Make sure the libgpiod-dev (>= 1.5) package is available on your system, eg sudo apt install libgpiod-dev
  • Don't forget to link libgpiod when building (-lgpiod)
Parameters
pulse_outputthe rts_pulse_output struct to initialize
devicethe device file to use with gpiod, eg "/dev/gpiochip0"
data_pinthe GPIO offset to output to, typically the GPIO pin number

◆ rts_pulse_source_init_gpiod()

void rts_pulse_source_init_gpiod ( struct rts_pulse_source pulse_source,
char *  device,
uint8_t  data_pin 
)
related

Initialize an rts_pulse_source which receives pulses from the specified Linux gpiod device.

Note
  • Can be enabled on Linux systems by defining the OPENRTS_HAS_GPIOD macro
  • Make sure the libgpiod-dev (>= 1.5) package is available on your system, eg sudo apt install libgpiod-dev
  • Don't forget to link libgpiod when building (-lgpiod)
Parameters
pulse_sourcethe rts_pulse_source struct to initialize
devicethe device file to use with gpiod, eg "/dev/gpiochip0"
data_pinthe GPIO offset to monitor, typically the GPIO pin number

◆ rts_remote_store_init_mmap()

void rts_remote_store_init_mmap ( struct rts_remote_store store,
const char *  filename 
)
related

Initialize an rts_remote_store which stores remotes and rolling codes in a memory-mapped file on POSIX systems.

Parameters
storethe rts_remote_store struct to initialize
filenamethe path of the filename to store remote data

◆ rts_frame_init()

void rts_frame_init ( struct rts_frame frame,
enum rts_command  command,
uint16_t  rolling_code,
uint32_t  remote_address 
)
related

Initialize an rts_frame with typical payload.

We'll generate a sensible encryption_key automatically.

Parameters
framethe frame to initialize
commandthe rts_command
rolling_codethe rolling code
remote_addressthe remote address

◆ rts_frame_from_bytes()

void rts_frame_from_bytes ( struct rts_frame frame,
const uint8_t *  bytes 
)
related

Initialize an rts_frame from the raw (deobfuscated) bytes received.

Parameters
framethe frame to initialize
bytesthe raw frame bytes to construct from

◆ rts_frame_to_bytes()

void rts_frame_to_bytes ( struct rts_frame frame,
uint8_t *  bytes,
bool  obfuscate 
)
related

Convert an rts_frame to byte representation, and optionally apply XOR obfuscation to make it ready to send.

Parameters
framethe frame to convert
bytesthe byte array to store the result in
obfuscateshould we also apply obfuscation to the bytes

◆ rts_frame_obfuscate_bytes()

void rts_frame_obfuscate_bytes ( uint8_t *  bytes)
related

Apply in-place XOR obfuscation to a raw byte array representation of a frame.

Parameters
bytesthe raw frame bytes to obfuscate

◆ rts_frame_deobfuscate_bytes()

void rts_frame_deobfuscate_bytes ( uint8_t *  dest,
const uint8_t *  src 
)
related

Apply XOR deobfuscation to a raw byte array representation of a frame.

Parameters
destthe destination byte array for the deobfuscated frame bytes
srcthe raw frame bytes to deobfuscate

◆ rts_frame_generate_checksum()

uint8_t rts_frame_generate_checksum ( const uint8_t *  bytes)
related

Generate a checksum for the raw (deobfuscated) bytes of a frame.

Checksum for a valid frame is 0.

Parameters
bytesthe raw deobfuscated frame bytes to check

◆ rts_frame_builder_init()

void rts_frame_builder_init ( struct rts_frame_builder builder,
struct rts_timings timings 
)
related

Initialize an rts_frame_builder with the specified timings.

Parameters
builderthe rts_frame_builder struct to initialize
timingsthe rts_timings struct to use for pulse decoding

◆ rts_frame_builder_handle_pulse()

void rts_frame_builder_handle_pulse ( struct rts_frame_builder builder,
bool  state,
uint32_t  micros 
)
related

Inform the frame builder about a new pulse.

This is typically called from an rts_pulse_source that has been attached using rts_pulse_source_attach.

Parameters
builderthe rts_frame_builder struct
stateboolean pulse logic state, true = HIGH, false = LOW
microsthe time the pulse was in this state, in microseconds

◆ rts_frame_builder_set_callback()

void rts_frame_builder_set_callback ( struct rts_frame_builder builder,
void(*)(struct rts_frame *frame, uint8_t count, uint32_t duration, void *user_data)  callback,
void *  user_data 
)
related

Set a callback to call when new complete frames are received.

Parameters
builderthe rts_frame_builder struct
callbackthe callback to fire
user_dataoptional custom user data pointer, will be included as the last parameter when callback is fired

◆ rts_pulse_output_enable()

void rts_pulse_output_enable ( struct rts_pulse_output pulse_output)
related

Enable the pulse output.

Parameters
pulse_outputthe rts_pulse_output struct to enable

◆ rts_pulse_output_disable()

void rts_pulse_output_disable ( struct rts_pulse_output pulse_output)
related

Disable the pulse output.

Parameters
pulse_outputthe rts_pulse_output struct to disable

◆ rts_pulse_output_send_pulse()

void rts_pulse_output_send_pulse ( struct rts_pulse_output pulse_output,
bool  state,
uint32_t  micros 
)
related

Instruct the rts_pulse_output to output a pulse.

Parameters
pulse_outputthe rts_pulse_output struct
stateboolean pulse logic state, true = HIGH, false = LOW
microsthe time the pulse was in this state, in microseconds

◆ rts_pulse_output_close()

void rts_pulse_output_close ( struct rts_pulse_output pulse_output)
related

Close and free resources allocated via a previous call to rts_pulse_output_init_*()

Parameters
pulse_outputthe rts_pulse_output to close

◆ rts_pulse_source_enable()

void rts_pulse_source_enable ( struct rts_pulse_source pulse_source)
related

Enable the pulse source.

Parameters
pulse_sourcethe rts_pulse_source struct to enable

◆ rts_pulse_source_disable()

void rts_pulse_source_disable ( struct rts_pulse_source pulse_source)
related

Disable the pulse source.

Parameters
pulse_sourcethe rts_pulse_source struct to disable

◆ rts_pulse_source_update()

void rts_pulse_source_update ( struct rts_pulse_source pulse_source)
related

Check for new pulse data, should be called every loop()

Parameters
pulse_sourcethe rts_pulse_source struct to update

◆ rts_pulse_source_attach()

void rts_pulse_source_attach ( struct rts_pulse_source pulse_source,
struct rts_frame_builder frame_builder 
)
related

Attach an observer.

Parameters
pulse_sourcethe rts_pulse_source to be observed
frame_builderthe rts_frame_builder observing this source.

◆ rts_pulse_source_close()

void rts_pulse_source_close ( struct rts_pulse_source pulse_source)
related

Close and free any resources allocated via a previous call to rts_pulse_source_init_*()

Parameters
pulse_sourcethe rts_pulse_source to close

◆ rts_radio_init_rfm69()

struct rfm69 * rts_radio_init_rfm69 ( struct rts_radio radio,
struct spi_module spi 
)
related

Initialize an rts_radio to use an SX1231/RFM69 radio module.

Parameters
radiothe rts_radio struct to initialize
spithe spi module to communicate with

◆ rts_radio_init_sx1278()

struct sx1278 * rts_radio_init_sx1278 ( struct rts_radio radio,
struct spi_module spi 
)
related

Initialize an rts_radio to use an SX1278/RFM96 radio module.

Parameters
radiothe rts_radio struct to initialize
spithe spi module to communicate with

◆ rts_radio_set_mode()

void rts_radio_set_mode ( struct rts_radio radio,
enum rts_radio_mode  mode 
)
related

Set the radio mode for the specified rts_radio module, eg.

standby, receive, or transmit.

Parameters
radiothe rts_radio struct to set the mode for
modethe rts_radio_mode to enter

◆ rts_receiver_init()

void rts_receiver_init ( struct rts_receiver receiver,
struct rts_pulse_source pulse_source,
struct rts_remote_store remote_store 
)
related

Initialize an rts_receiver.

Parameters
receiverthe rts_receiver struct to initialize
pulse_sourcethe rts_pulse_source to receive pulses from
remote_storethe rts_remote_store to persist paired remotes to

◆ rts_receiver_set_frame_callback()

void rts_receiver_set_frame_callback ( struct rts_receiver receiver,
void(*)(enum rts_receiver_event, struct rts_frame *frame, void *user_data)  callback,
void *  user_data 
)
related

Set a callback function to call when new receiver events are received.

Parameters
receiverthe rts_receiver struct to set callback on
callbackthe callback function to call when new frame events are received. Frame events are fired after RTS frames are parsed and deduplicated.
user_dataoptional user_data pointer to pass to every callback. Set to NULL if not using.

◆ rts_receiver_set_mode_callback()

void rts_receiver_set_mode_callback ( struct rts_receiver receiver,
void(*)(enum rts_receiver_mode, void *user_data)  callback,
void *  user_data 
)
related

Set a callback function to call when the receiver mode changes.

Parameters
receiverthe rts_receiver struct to set callback on
callbackthe callback function to call when the mode changes
user_dataoptional user_data pointer top pass to every callback. Set to NULL if not using.

◆ rts_receiver_set_mode()

void rts_receiver_set_mode ( struct rts_receiver receiver,
uint8_t  mode 
)
related

Change the receiver mode.

Receivers can be either "off", in "programming" mode or "command" mode.

Parameters
receiverthe rts_receiver struct to change the mode of
modethe rts_receiver_mode to change to

◆ rts_receiver_forget_all_remotes()

void rts_receiver_forget_all_remotes ( struct rts_receiver receiver)
related

Convenience function to forget all paired remotes by clearing the receiver's rts_remote_store.

Parameters
receiverthe rts_receiver struct to forget remotes for

◆ rts_receiver_update()

void rts_receiver_update ( struct rts_receiver receiver)
related

Instruct the receiver's rts_pulse_source to check for new pulse data, should be called every loop() if the pulse source does not keep itself updated (eg.

using interrupts).

Parameters
receiverthe rts_receiver struct to update

◆ rts_remote_init()

void rts_remote_init ( struct rts_remote remote,
struct rts_pulse_output pulse_output,
struct rts_remote_store remote_store,
struct rts_timings timings 
)
related

Initialize the rts_remote struct.

Parameters
remotethe rts_remote struct to initialize
pulse_outputwhere to send pulses to
remote_storewhere to get/set remote rolling codes
timingsthe rts_timings struct to use for pulse encoding

◆ rts_remote_send_command()

void rts_remote_send_command ( struct rts_remote remote,
uint32_t  address,
enum rts_command  command,
bool  repeated 
)
related

Send a "button press" command.

This is the simplest way to use an rts_remote, which automatically creates an rts_frame struct under the hood, and handles the incrementing of rolling codes in the internal rts_remote_store.

The generated rts_frame is passed to rts_remote_send_frame.

Parameters
remotethe rts_remote struct
addressthe remote address to send from
commandthe rts command to send (see rts_command enum)
repeatedis this a "repeated" command, eg. from a button being held down? If so we won't increment the remote's rolling code

◆ rts_remote_send_frame()

void rts_remote_send_frame ( struct rts_remote remote,
struct rts_frame frame,
bool  repeated 
)
related

Send an RTS frame.

This function converts the provided rts_frame into a series of pulses, which are passed along to the internal rts_pulse_output by rts_remote_send_pulse.

Parameters
remotethe rts_remote struct
framethe rts_frame to send
repeatedis this a "repeated" command, eg. from a button being held down? If so we won't increment the remote's rolling code

◆ rts_remote_send_pulse()

void rts_remote_send_pulse ( struct rts_remote remote,
bool  state,
uint32_t  micros 
)
related

Send a single pulse to the internal rts_pulse_output.

Parameters
remotethe rts_remote struct
stateboolean pulse logic state, true = HIGH, false = LOW
microshow long to set the pulse to this state, in microseconds

◆ rts_remote_store_set_code()

void rts_remote_store_set_code ( struct rts_remote_store store,
uint32_t  remote_address,
uint16_t  rolling_code 
)
related

Set the rolling code for this remote, create if doesn't exist.

Parameters
storethe rts_remote_store struct to set the code to
remote_addressthe address of the remote control
rolling_codethe rolling code to set

◆ rts_remote_store_get_code()

uint16_t rts_remote_store_get_code ( struct rts_remote_store store,
uint32_t  remote_address 
)
related

Get the rolling code for this remote.

Parameters
storethe rts_remote_store struct to get the code from
remote_addressthe address of the remote control
Returns
the rolling code for this remote

◆ rts_remote_store_next_code()

uint16_t rts_remote_store_next_code ( struct rts_remote_store store,
uint32_t  remote_address 
)
related

Get the rolling code for this remote, then increment and persist.

Parameters
storethe rts_remote_store struct to get the code from
remote_addressthe address of the remote control
Returns
the rolling code for this remote

◆ rts_remote_store_known_remote()

bool rts_remote_store_known_remote ( struct rts_remote_store store,
uint32_t  remote_address 
)
related

Check if this is a known remote address.

Parameters
storethe rts_remote_store struct to check in
remote_addressthe address of the remote control

◆ rts_remote_store_forget()

void rts_remote_store_forget ( struct rts_remote_store store,
uint32_t  remote_address 
)
related

Forget a specific remote.

Parameters
storethe rts_remote_store struct
remote_addressthe address of the remote control to forget

◆ rts_remote_store_clear()

void rts_remote_store_clear ( struct rts_remote_store store)
related

Clear all remotes and rolling codes.

Parameters
storethe rts_remote_store struct to clear

◆ rts_remote_store_close()

void rts_remote_store_close ( struct rts_remote_store store)
related

Close and free any resources allocated via a previous call to rts_remote_store_init*()

Parameters
storethe rts_remote_store to close

◆ rts_remote_store_init_memory()

void rts_remote_store_init_memory ( struct rts_remote_store store)
related

Initialize an rts_remote_store which stores remotes and rolling codes in memory.

Parameters
storethe rts_remote_store struct to initialize