add (some) spurious IR detection capability

This commit is contained in:
philippe44
2023-09-18 18:34:03 -07:00
parent a76ce3f344
commit e0e749fb5b
3 changed files with 142 additions and 83 deletions

View File

@@ -22,6 +22,8 @@ static const char* TAG = "IR";
#define IR_TOOLS_FLAGS_PROTO_EXT (1 << 0) /*!< Enable Extended IR protocol */
#define IR_TOOLS_FLAGS_INVERSE (1 << 1) /*!< Inverse the IR signal, i.e. take high level as low, and vice versa */
static int8_t ir_gpio = -1;
/**
* @brief IR device type
*
@@ -478,6 +480,12 @@ bool infrared_receive(RingbufHandle_t rb, infrared_handler handler) {
return decoded;
}
/****************************************************************************************
*
*/
int8_t infrared_gpio(void) {
return ir_gpio;
};
/****************************************************************************************
*
@@ -491,6 +499,7 @@ void infrared_init(RingbufHandle_t *rb, int gpio, infrared_mode_t mode) {
ir_parser_config.flags |= IR_TOOLS_FLAGS_PROTO_EXT; // Using extended IR protocols (both NEC and RC5 have extended version)
ir_parser = (mode == IR_NEC) ? ir_parser_rmt_new_nec(&ir_parser_config) : ir_parser_rmt_new_rc5(&ir_parser_config);
ir_gpio = gpio;
// get RMT RX ringbuffer
rmt_get_ringbuf_handle(rmt_channel, rb);