irsense4 2.1.0.0
IR Sense 4 Click Driver

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

Topics

 IR Sense 4 Registers List
 List of registers of IR Sense 4 Click driver.
 
 IR Sense 4 Registers Settings
 Settings for registers of IR Sense 4 Click driver.
 
 IR Sense 4 MikroBUS Map
 MikroBUS pin mapping of IR Sense 4 Click driver.
 

Functions

void irsense4_cfg_setup (irsense4_cfg_t *cfg)
 IR Sense 4 configuration object setup function.
 
void irsense4_drv_interface_selection (irsense4_cfg_t *cfg, irsense4_drv_t drv_sel)
 IR Sense 4 driver interface setup function.
 
err_t irsense4_init (irsense4_t *ctx, irsense4_cfg_t *cfg)
 IR Sense 4 initialization function.
 
err_t irsense4_default_cfg (irsense4_t *ctx)
 IR Sense 4 default configuration function.
 
err_t irsense4_generic_write (irsense4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 IR Sense 4 data writing function.
 
err_t irsense4_generic_read (irsense4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 IR Sense 4 data reading function.
 
err_t irsense4_write_reg (irsense4_t *ctx, uint8_t reg, uint8_t data_in)
 IR Sense 4 write register function.
 
err_t irsense4_read_reg (irsense4_t *ctx, uint8_t reg, uint8_t *data_out)
 IR Sense 4 read register function.
 
err_t irsense4_read_word (irsense4_t *ctx, uint8_t reg, int16_t *data_out)
 IR Sense 4 read word function.
 
err_t irsense4_set_lp_filter_motion (irsense4_t *ctx, uint8_t lpf_m)
 IR Sense 4 set low-pass filter for motion function.
 
err_t irsense4_set_lp_filter_presence (irsense4_t *ctx, uint8_t lpf_p)
 IR Sense 4 set low-pass filter for presence function.
 
err_t irsense4_set_lp_filter_amb_temp (irsense4_t *ctx, uint8_t lpf_at)
 IR Sense 4 set low-pass filter for ambient temperature function.
 
err_t irsense4_get_device_id (irsense4_t *ctx, uint8_t *device_id)
 IR Sense 4 get device ID function.
 
err_t irsense4_set_avr_temp (irsense4_t *ctx, uint8_t avr_amp_temp, uint8_t avr_obj_temp)
 IR Sense 4 set averages for temperature function.
 
err_t irsense4_set_gain_mode (irsense4_t *ctx, uint8_t gain_mode)
 IR Sense 4 set gain mode function.
 
err_t irsense4_set_sens_data (irsense4_t *ctx, uint16_t sens)
 IR Sense 4 set sensitivity data function.
 
err_t irsense4_config_odr (irsense4_t *ctx, uint8_t odr)
 IR Sense 4 set output data rate function.
 
err_t irsense4_enable_one_shot (irsense4_t *ctx)
 IR Sense 4 enable one-shot mode function.
 
err_t irsense4_set_int_mask (irsense4_t *ctx, uint8_t int_mask)
 IR Sense 4 set interrupt masks for flag function.
 
err_t irsense4_config_int_signal (irsense4_t *ctx, uint8_t int_sr)
 IR Sense 4 configur interrupt the signal function.
 
err_t irsense4_wait_new_data_ready (irsense4_t *ctx)
 IR Sense 4 wait new data ready function.
 
err_t irsense4_get_status (irsense4_t *ctx, uint8_t *status)
 IR Sense 4 get status function.
 
err_t irsense4_get_obj_temperature (irsense4_t *ctx, float *temperature)
 IR Sense 4 get the object temperature function.
 
err_t irsense4_get_amb_temperature (irsense4_t *ctx, float *temperature)
 IR Sense 4 get the ambient temperature function.
 
err_t irsense4_get_comp_temperature (irsense4_t *ctx, float *temperature)
 IR Sense 4 get the compensated temperature function.
 
err_t irsense4_get_presence_data (irsense4_t *ctx, int16_t *presence)
 IR Sense 4 get the presence detection data function.
 
err_t irsense4_get_motion_data (irsense4_t *ctx, int16_t *motion)
 IR Sense 4 get the motion detection data function.
 
err_t irsense4_get_amb_shock_data (irsense4_t *ctx, int16_t *shock)
 IR Sense 4 get the ambient shock detection data function.
 
err_t irsense4_write_emb_reg (irsense4_t *ctx, uint8_t reg_emb, uint8_t data_in)
 IR Sense 4 write the embedded register function.
 
err_t irsense4_read_emb_reg (irsense4_t *ctx, uint8_t reg_emb, uint8_t *data_out)
 IR Sense 4 write register function.
 
err_t irsense4_set_threshold (irsense4_t *ctx, irsense4_ths_sel_t ths_sel, uint16_t threshold)
 IR Sense 4 set threshold data function.
 
err_t irsense4_get_threshold (irsense4_t *ctx, irsense4_ths_sel_t ths_sel, uint16_t *threshold)
 IR Sense 4 get the threshold data function.
 

Detailed Description

API for configuring and manipulating IR Sense 4 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

◆ irsense4_cfg_setup()

void irsense4_cfg_setup ( irsense4_cfg_t * cfg)

IR Sense 4 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ irsense4_config_int_signal()

err_t irsense4_config_int_signal ( irsense4_t * ctx,
uint8_t int_sr )

IR Sense 4 configur interrupt the signal function.

This function configur the signal routed to the interrupt pin of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]int_sr: Interrupt signal configuration.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_config_odr()

err_t irsense4_config_odr ( irsense4_t * ctx,
uint8_t odr )

IR Sense 4 set output data rate function.

This function sets output data rate of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]odr: Output data rate.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_default_cfg()

err_t irsense4_default_cfg ( irsense4_t * ctx)

IR Sense 4 default configuration function.

This function executes a default configuration of IR Sense 4 click board.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ irsense4_drv_interface_selection()

void irsense4_drv_interface_selection ( irsense4_cfg_t * cfg,
irsense4_drv_t drv_sel )

IR Sense 4 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 irsense4_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See irsense4_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.

◆ irsense4_enable_one_shot()

err_t irsense4_enable_one_shot ( irsense4_t * ctx)

IR Sense 4 enable one-shot mode function.

This function enable the one-shot mode (new data set is acquired) of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_generic_read()

err_t irsense4_generic_read ( irsense4_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

IR Sense 4 data reading function.

This function reads a desired number of data bytes starting from the selected register.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_generic_write()

err_t irsense4_generic_write ( irsense4_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

IR Sense 4 data writing function.

This function writes a desired number of data bytes starting from the selected register.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_get_amb_shock_data()

err_t irsense4_get_amb_shock_data ( irsense4_t * ctx,
int16_t * shock )

IR Sense 4 get the ambient shock detection data function.

This function reads the ambient shock detection output value of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[out]shock: Ambient shock detection output.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_get_amb_temperature()

err_t irsense4_get_amb_temperature ( irsense4_t * ctx,
float * temperature )

IR Sense 4 get the ambient temperature function.

This function reads the ambient temperature output value of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[out]temperature: Ambient temperature output value [degrees Celsius].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_get_comp_temperature()

err_t irsense4_get_comp_temperature ( irsense4_t * ctx,
float * temperature )

IR Sense 4 get the compensated temperature function.

This function reads the compensated temperature output value of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[out]temperature: Compensated temperature output value [degrees Celsius].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_get_device_id()

err_t irsense4_get_device_id ( irsense4_t * ctx,
uint8_t * device_id )

IR Sense 4 get device ID function.

This function reads device ID of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[out]device_id: Device ID.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_get_motion_data()

err_t irsense4_get_motion_data ( irsense4_t * ctx,
int16_t * motion )

IR Sense 4 get the motion detection data function.

This function reads the motion output value of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[out]motion: Motion detection output.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_get_obj_temperature()

err_t irsense4_get_obj_temperature ( irsense4_t * ctx,
float * temperature )

IR Sense 4 get the object temperature function.

This function reads the object temperature output value of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[out]temperature: Object temperature output value [degrees Celsius].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_get_presence_data()

err_t irsense4_get_presence_data ( irsense4_t * ctx,
int16_t * presence )

IR Sense 4 get the presence detection data function.

This function reads the presence output value of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[out]presence: Presence detection output.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_get_status()

err_t irsense4_get_status ( irsense4_t * ctx,
uint8_t * status )

IR Sense 4 get status function.

This function reads the status for the presence, motion or ambient temperature shock detection flags of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[out]status: Status of the detection flags.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_get_threshold()

err_t irsense4_get_threshold ( irsense4_t * ctx,
irsense4_ths_sel_t ths_sel,
uint16_t * threshold )

IR Sense 4 get the threshold data function.

This function reads the threshold data for detection algorithms of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]ths_sel: Threshold data selection. See irsense4_ths_sel_t object definition for detailed explanation.
[out]threshold: Threshold data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_init()

err_t irsense4_init ( irsense4_t * ctx,
irsense4_cfg_t * cfg )

IR Sense 4 initialization function.

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

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

◆ irsense4_read_emb_reg()

err_t irsense4_read_emb_reg ( irsense4_t * ctx,
uint8_t reg_emb,
uint8_t * data_out )

IR Sense 4 write register function.

This function writes a desired data bytes to the selected register of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]reg_emb: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_read_reg()

err_t irsense4_read_reg ( irsense4_t * ctx,
uint8_t reg,
uint8_t * data_out )

IR Sense 4 read register function.

This function reads a data bytes from the selected register of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_read_word()

err_t irsense4_read_word ( irsense4_t * ctx,
uint8_t reg,
int16_t * data_out )

IR Sense 4 read word function.

This function reads a 16-bit data starting from the selected register of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read 16-bit data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_set_avr_temp()

err_t irsense4_set_avr_temp ( irsense4_t * ctx,
uint8_t avr_amp_temp,
uint8_t avr_obj_temp )

IR Sense 4 set averages for temperature function.

This function select the number of averages for ambient and object temperature of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]avr_amp_temp: Number of averages for ambient temperature.
[in]avr_obj_temp: Number of averages for object temperature.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_set_gain_mode()

err_t irsense4_set_gain_mode ( irsense4_t * ctx,
uint8_t gain_mode )

IR Sense 4 set gain mode function.

This function set gain mode to cover a wide operating temperature range of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]gain_mode: Gain modes.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_set_int_mask()

err_t irsense4_set_int_mask ( irsense4_t * ctx,
uint8_t int_mask )

IR Sense 4 set interrupt masks for flag function.

This function sets interrupt masks for flag of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]int_mask: Interrupt masks for flag.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_set_lp_filter_amb_temp()

err_t irsense4_set_lp_filter_amb_temp ( irsense4_t * ctx,
uint8_t lpf_at )

IR Sense 4 set low-pass filter for ambient temperature function.

This function low-pass filter configuration for ambient temperature of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]lpf_at: Ambient temperature low-pass filter configuration.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_set_lp_filter_motion()

err_t irsense4_set_lp_filter_motion ( irsense4_t * ctx,
uint8_t lpf_m )

IR Sense 4 set low-pass filter for motion function.

This function low-pass filter configuration for motion of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]lpf_m: Motion low-pass filter configuration.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_set_lp_filter_presence()

err_t irsense4_set_lp_filter_presence ( irsense4_t * ctx,
uint8_t lpf_p )

IR Sense 4 set low-pass filter for presence function.

This function low-pass filter configuration for presence of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]lpf_p: Presence low-pass filter configuration.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_set_sens_data()

err_t irsense4_set_sens_data ( irsense4_t * ctx,
uint16_t sens )

IR Sense 4 set sensitivity data function.

This function set sensitivity data of the component that can be used for the compensation algorithm of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]sens: Sensitivity data [2048-6128].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_set_threshold()

err_t irsense4_set_threshold ( irsense4_t * ctx,
irsense4_ths_sel_t ths_sel,
uint16_t threshold )

IR Sense 4 set threshold data function.

This function sets threshold data for detection algorithms of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]ths_sel: Threshold data selection. See irsense4_ths_sel_t object definition for detailed explanation.
[in]threshold: Threshold data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_wait_new_data_ready()

err_t irsense4_wait_new_data_ready ( irsense4_t * ctx)

IR Sense 4 wait new data ready function.

This function wait until new set of output data is available of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_write_emb_reg()

err_t irsense4_write_emb_reg ( irsense4_t * ctx,
uint8_t reg_emb,
uint8_t data_in )

IR Sense 4 write the embedded register function.

This function writes a desired data bytes to the selected embedded register address of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]reg_emb: Embedded register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ irsense4_write_reg()

err_t irsense4_write_reg ( irsense4_t * ctx,
uint8_t reg,
uint8_t data_in )

IR Sense 4 write register function.

This function writes a desired data bytes to the selected register of the STHS34PF80, Low-power, high-sensitivity infrared sensor for presence and motion detection on the IR Sense 4 Click board™.

Parameters
[in]ctx: Click context object. See irsense4_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.