pir 2.0.0.0
Public function

Functions

void pir_cfg_setup (pir_cfg_t *cfg)
 Config Object Initialization function.
 
PIR_RETVAL pir_init (pir_t *ctx, pir_cfg_t *cfg)
 Initialization function.
 
void pir_generic_write (pir_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void pir_generic_read (pir_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
uint16_t pir_get_adc (pir_t *ctx)
 Reading 12bit ADC value.
 
uint16_t pir_reg_read (pir_t *ctx)
 Reading register.
 
float pir_get_mili_volt (pir_t *ctx, uint16_t ref_voltage)
 Reading ADC data in mili Volts.
 
float pir_scale_results (pir_t *ctx, uint16_t in_val, uint16_t out_min, uint16_t out_max)
 Scaling ADC results.
 

Detailed Description

Function Documentation

◆ pir_cfg_setup()

void pir_cfg_setup ( pir_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ pir_generic_read()

void pir_generic_read ( pir_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

@description This function reads data from the desired register.

◆ pir_generic_write()

void pir_generic_write ( pir_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

@description This function writes data to the desired register.

◆ pir_get_adc()

uint16_t pir_get_adc ( pir_t * ctx)

Reading 12bit ADC value.

Parameters
ctxClick object.

This function reads single ADC conversion data

◆ pir_get_mili_volt()

float pir_get_mili_volt ( pir_t * ctx,
uint16_t ref_voltage )

Reading ADC data in mili Volts.

Parameters
ctxClick object.
ref_voltagereference voltage in miliVolts (3300 or 5000 miliVolts).

This function reads 12bit ADC data and convets it to miliVolts

◆ pir_init()

PIR_RETVAL pir_init ( pir_t * ctx,
pir_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

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

◆ pir_reg_read()

uint16_t pir_reg_read ( pir_t * ctx)

Reading register.

Parameters
ctxClick object.

This function reads register

◆ pir_scale_results()

float pir_scale_results ( pir_t * ctx,
uint16_t in_val,
uint16_t out_min,
uint16_t out_max )

Scaling ADC results.

Parameters
ctxClick object.
in_valADC conversion raw data
out_minlower limit of output data
out_maxupper limit of output data

This function scales ADC conversion data (inVal) to desired range (from outMin to outMax) and returns scaled data (outVal)