objc

Data Structures | Typedefs | Enumerations | Functions

Infrared receiver interface for capturing and processing IR remote control signals. More...

Collaboration diagram for Infrared:

Data Structures

struct  hw_infrared_rx_t
 Infrared receiver. More...
 

Typedefs

typedef struct hw_infrared_rx_t hw_infrared_rx_t
 Infrared receiver.
 
typedef enum hw_infrared_event_t hw_infrared_event_t
 Infrared events.
 
typedef void(* hw_infrared_rx_callback_t) (hw_infrared_event_t event, uint32_t duration_us, void *user_data)
 Infrared receiver.
 

Enumerations

enum  hw_infrared_event_t { HW_INFRARED_EVENT_TIMEOUT = (1 << 0), HW_INFRARED_EVENT_MARK = (1 << 1), HW_INFRARED_EVENT_SPACE = (1 << 2) }
 Infrared events.
 

Functions

hw_infrared_rx_t hw_infrared_rx_init (uint8_t gpio, hw_infrared_rx_callback_t callback, void *user_data)
 Initialize a Infrared receiver. More...
 
bool hw_infrared_rx_valid (hw_infrared_rx_t *rx)
 Check if an Infrared receiver is valid. More...
 
void hw_infrared_rx_finalize (hw_infrared_rx_t *rx)
 Finalize and release an Infrared receiver. More...
 

Detailed Description

Infrared receiver interface for capturing and processing IR remote control signals.

This module provides functions to initialize an IR receiver, configure callbacks for signal events, and process MARK/SPACE/TIMEOUT timing data. The implementation of specific protocols is included in the driver library.

The callback is called with either MARK (high pulse), SPACE (low pulse), or TIMEOUT (overly long pulse) events. Events above 50ms are marked as TIMEOUT values, in which case detection of specific IR codes should be reset.

Function Documentation

◆ hw_infrared_rx_finalize()

void hw_infrared_rx_finalize ( hw_infrared_rx_t rx)

Finalize and release an Infrared receiver.

Parameters
rxPointer to the Infrared receiver structure to finalize.

This function stops the Infrared receiver and releases all associated resources. After calling this function, the Infrared receiver should not be used.

Examples:
examples/runtime/infrared/main.c.

◆ hw_infrared_rx_init()

hw_infrared_rx_t hw_infrared_rx_init ( uint8_t  gpio,
hw_infrared_rx_callback_t  callback,
void *  user_data 
)

Initialize a Infrared receiver.

Parameters
gpioThe GPIO pin number for the Infrared receiver.
callbackThe callback function to be called on IR events.
user_dataPointer to user data to be passed to the callback.
Returns
A Infrared receiver structure representing the initialized unit.

This function initializes an Infrared receiver on the specified GPIO pin. and with the specified user data.

Examples:
examples/runtime/infrared/main.c.

◆ hw_infrared_rx_valid()

bool hw_infrared_rx_valid ( hw_infrared_rx_t rx)

Check if an Infrared receiver is valid.

Parameters
rxPointer to the Infrared receiver structure to check.
Returns
true if the Infrared receiver is valid, false otherwise.

This function checks if the Infrared receiver has been properly initialized and is ready to use.

Examples:
examples/runtime/infrared/main.c.