ir 2.0.0.0
IR Click Driver

API for configuring and manipulating IR Click driver. More...

Topics

 IR Device Settings
 Settings for registers of IR Click driver.
 
 IR MikroBUS Map
 MikroBUS pin mapping of IR Click driver.
 

Functions

void ir_cfg_setup (ir_cfg_t *cfg)
 IR configuration object setup function.
 
void ir_drv_interface_selection (ir_cfg_t *cfg, ir_drv_t drv_sel)
 IR driver interface setup function.
 
err_t ir_init (ir_t *ctx, ir_cfg_t *cfg)
 IR initialization function.
 
err_t ir_generic_write (ir_t *ctx, char *data_buf, uint16_t len)
 IR data writing function.
 
err_t ir_generic_read (ir_t *ctx, char *data_buf, uint16_t max_len)
 IR data reading function.
 
uint8_t ir_get_an_state (ir_t *ctx)
 IR get AN pin state function.
 
void ir_nec_send_command (ir_t *ctx, uint8_t address, uint8_t command)
 IR NEC send data function.
 
err_t ir_nec_read_command (ir_t *ctx, uint8_t *address, uint8_t *command)
 IR NEC data reading function.
 

Detailed Description

API for configuring and manipulating IR Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ ir_cfg_setup()

void ir_cfg_setup ( ir_cfg_t * cfg)

IR configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See ir_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ ir_drv_interface_selection()

void ir_drv_interface_selection ( ir_cfg_t * cfg,
ir_drv_t drv_sel )

IR driver interface setup function.

This function sets a serial driver interface which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See ir_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See ir_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be call before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ ir_generic_read()

err_t ir_generic_read ( ir_t * ctx,
char * data_buf,
uint16_t max_len )

IR data reading function.

This function reads a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See ir_t object definition for detailed explanation.
[out]data_buf: Output read data.
[in]max_len: Number of bytes to be read.
Returns
  • >0 - Number of data bytes read,
  • <=0 - Error/Empty Ring buffer.
See #err_t definition for detailed explanation.

◆ ir_generic_write()

err_t ir_generic_write ( ir_t * ctx,
char * data_buf,
uint16_t len )

IR data writing function.

This function writes a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See ir_t object definition for detailed explanation.
[in]data_buf: Data buffer for sending.
[in]len: Number of bytes for sending.
Returns
  • >=0 - Success,
  • <0 - Error.
See #err_t definition for detailed explanation.

◆ ir_get_an_state()

uint8_t ir_get_an_state ( ir_t * ctx)

IR get AN pin state function.

This function reads a state of the AN pin, when AN is low there is IR signal receaved by TSOP38338 IR receiver module.

Parameters
[in]ctx: Click context object. See ir_t object definition for detailed explanation.
Returns
State of the AN pin.

◆ ir_init()

err_t ir_init ( ir_t * ctx,
ir_cfg_t * cfg )

IR initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See ir_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See ir_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ ir_nec_read_command()

err_t ir_nec_read_command ( ir_t * ctx,
uint8_t * address,
uint8_t * command )

IR NEC data reading function.

This function reads a byte of address and command data by using NEC protocol.

Parameters
[in]ctx: Click context object. See ir_t object definition for detailed explanation.
[out]address: Output read address data.
[out]command: Output read command data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can only be used in GPIO mode.

◆ ir_nec_send_command()

void ir_nec_send_command ( ir_t * ctx,
uint8_t address,
uint8_t command )

IR NEC send data function.

This function sends a 8-bit command to a 8-bit address using NEC protocol.

Parameters
[in]ctx: Click context object. See ir_t object definition for detailed explanation.
[in]address: Input address data.
[in]command: Input command data.
Returns
Nothing.
Note
This function can only be used in GPIO mode.