pac1921  2.0.0.0
Functions
Public function

Functions

void pac1921_cfg_setup (pac1921_cfg_t *cfg)
 Config Object Initialization function. More...
 
PAC1921_RETVAL pac1921_init (pac1921_t *ctx, pac1921_cfg_t *cfg)
 Initialization function. More...
 
void pac1921_default_cfg (pac1921_t *ctx)
 Click Default Configuration function. More...
 
void pac1921_generic_write (pac1921_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function. More...
 
void pac1921_generic_read (pac1921_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function. More...
 
void pac1921_write_to_reg (pac1921_t *ctx, uint8_t reg_addr, uint8_t *write_data, uint8_t len)
 Register write function. More...
 
float pac1921_get_measured_data (pac1921_t *ctx, uint8_t measurement_mode, uint8_t sample_num)
 Measured data read function. More...
 
void pac1921_set_int_pin (pac1921_t *ctx, uint8_t output)
 INT pin set output function. More...
 
uint8_t pac1921_get_an_pin (pac1921_t *ctx)
 AN pin get input function. More...
 

Detailed Description

Function Documentation

◆ pac1921_cfg_setup()

void pac1921_cfg_setup ( pac1921_cfg_t cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ pac1921_default_cfg()

void pac1921_default_cfg ( pac1921_t ctx)

Click Default Configuration function.

Parameters
ctxClick object.

This function executes default configuration for PAC1921 click.

◆ pac1921_generic_read()

void pac1921_generic_read ( pac1921_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

This function reads data from the desired register.

◆ pac1921_generic_write()

void pac1921_generic_write ( pac1921_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.

This function writes data to the desired register.

◆ pac1921_get_an_pin()

uint8_t pac1921_get_an_pin ( pac1921_t ctx)

AN pin get input function.

Parameters
ctxClick object.

This function gets the digital input from the analog pin.

◆ pac1921_get_measured_data()

float pac1921_get_measured_data ( pac1921_t ctx,
uint8_t  measurement_mode,
uint8_t  sample_num 
)

Measured data read function.

Parameters
ctxClick object.
measurement_modeMeasurement mode of the PAC1921 chip.
sample_numNumber of samples that will be acquired.

This function gathers voltage/power data from the PAC1921 chip and, depending on the measurement mode, converts those raw values into a more suitable form.

◆ pac1921_init()

PAC1921_RETVAL pac1921_init ( pac1921_t ctx,
pac1921_cfg_t cfg 
)

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

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

◆ pac1921_set_int_pin()

void pac1921_set_int_pin ( pac1921_t ctx,
uint8_t  output 
)

INT pin set output function.

Parameters
ctxClick object.
outputPin digital output.

This function sets the digital output on the interrupt pin.

◆ pac1921_write_to_reg()

void pac1921_write_to_reg ( pac1921_t ctx,
uint8_t  reg_addr,
uint8_t *  write_data,
uint8_t  len 
)

Register write function.

Parameters
ctxClick object.
reg_addrRegister address.
write_dataData which will be written.
lenSize of write_data in bytes.

This function writes data to the specified register address/es and saves the state of the register/s so it doesn't write the same value/s twice.