Open RTS
Full implementation of the Somfy RTS protocol
Loading...
Searching...
No Matches
rts_receiver Struct Reference

Simulates a physical RTS receiver device, such as a shade or drapery motor. More...

#include <rts_receiver.h>

Inherited by RTSReceiver [protected].

Related Symbols

(Note that these are not member symbols.)

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.
 

Detailed Description

Simulates a physical RTS receiver device, such as a shade or drapery motor.

It connects an rts_pulse_source (eg. a GPIO or radio) to an internal rts_frame_builder and adds common receiver functionality such as frame de-duplication, remote pairing, and rolling code validation.

De-duplicated frame "events" such as "remote button pressed" and "remote button held" are sent to the event callback you attach with rts_receiver_set_frame_callback.

Paired remotes and rolling codes can be persisted by providing a rts_remote_store backend (eg. ESP32's non-volatile storage, Arduino's EEPROM, or something custom if you'd prefer).

Receivers can be in one of three modes: "off", "programming" or "command".

In "off" mode, the receiver will not process any commands from remotes. To re-enable processing of commands, you'll need to call rts_receiver_set_mode(). Typically you'll want to call this when the user presses a physical button on the receiver, as on real RTS devices.

In "programming" mode, the receiver will process pairing/unpairing commands from remotes (Prog button pressed), and also process "RTS Off" commands from remotes (My+Up+Down buttons pressed and held).

In "command" mode, the receiver will process regular RTS frame events with rolling code validation, and handle certain special events such as allowing a paired remote to enter "programming" mode by pressing and holding "Prog".


The documentation for this struct was generated from the following file: