pir2 2.1.0.0
Modules | Functions
PIR 2 Click Driver

API for configuring and manipulating PIR 2 Click driver. More...

Modules

 PIR 2 Registers Settings
 Settings for registers of PIR 2 Click driver.
 
 PIR 2 MikroBUS Map
 MikroBUS pin mapping of PIR 2 Click driver.
 

Functions

void pir2_cfg_setup (pir2_cfg_t *cfg)
 PIR 2 configuration object setup function. More...
 
void pir2_drv_interface_sel (pir2_cfg_t *cfg, pir2_drv_t drv_sel)
 PIR 2 driver interface setup function. More...
 
err_t pir2_init (pir2_t *ctx, pir2_cfg_t *cfg)
 PIR 2 initialization function. More...
 
err_t pir2_read_raw_adc (pir2_t *ctx, uint16_t *raw_adc)
 PIR 2 read raw ADC value function. More...
 
err_t pir2_read_voltage (pir2_t *ctx, float *voltage)
 PIR 2 read voltage level function. More...
 
err_t pir2_set_vref (pir2_t *ctx, float vref)
 PIR 2 set vref function. More...
 

Detailed Description

API for configuring and manipulating PIR 2 Click driver.

Function Documentation

◆ pir2_cfg_setup()

void pir2_cfg_setup ( pir2_cfg_t cfg)

PIR 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ pir2_drv_interface_sel()

void pir2_drv_interface_sel ( pir2_cfg_t cfg,
pir2_drv_t  drv_sel 
)

PIR 2 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 pir2_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See pir2_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be called 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.

◆ pir2_init()

err_t pir2_init ( pir2_t ctx,
pir2_cfg_t cfg 
)

PIR 2 initialization function.

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

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

◆ pir2_read_raw_adc()

err_t pir2_read_raw_adc ( pir2_t ctx,
uint16_t *  raw_adc 
)

PIR 2 read raw ADC value function.

This function reads raw ADC value.

Parameters
[in]ctx: Click context object. See pir2_t object definition for detailed explanation.
[out]raw_adc: Output ADC result.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ pir2_read_voltage()

err_t pir2_read_voltage ( pir2_t ctx,
float *  voltage 
)

PIR 2 read voltage level function.

This function reads raw ADC value and converts it to proportional voltage level.

Parameters
[in]ctx: Click context object. See pir2_t object definition for detailed explanation.
[out]voltage: Output voltage level [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The conversion to voltage depends on the entered reference voltage.

◆ pir2_set_vref()

err_t pir2_set_vref ( pir2_t ctx,
float  vref 
)

PIR 2 set vref function.

This function sets the voltage reference for PIR 2 click driver.

Parameters
[in]ctx: Click context object. See pir2_t object definition for detailed explanation.
[in]vref: Reference voltage (volts).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The default voltage reference set with pir2_init is 3.3V.