accel22 2.0.0.0
Accel 22 Click Driver

API for configuring and manipulating Accel 22 Click driver. More...

Topics

 Accel 22 Registers List
 List of registers of Accel 22 Click driver.
 
 Accel 22 Registers Settings
 Settings for registers of Accel 22 Click driver.
 
 Accel 22 MikroBUS Map
 MikroBUS pin mapping of Accel 22 Click driver.
 

Functions

void accel22_cfg_setup (accel22_cfg_t *cfg)
 Accel 22 configuration object setup function.
 
void accel22_drv_interface_selection (accel22_cfg_t *cfg, accel22_drv_t drv_sel)
 Accel 22 driver interface setup function.
 
err_t accel22_init (accel22_t *ctx, accel22_cfg_t *cfg)
 Accel 22 initialization function.
 
err_t accel22_default_cfg (accel22_t *ctx)
 Accel 22 default configuration function.
 
err_t accel22_generic_write (accel22_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Accel 22 data writing function.
 
err_t accel22_generic_read (accel22_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Accel 22 data reading function.
 
err_t accel22_write_register (accel22_t *ctx, uint8_t reg, uint8_t data_in)
 Accel 22 write register function.
 
err_t accel22_read_register (accel22_t *ctx, uint8_t reg, uint8_t *data_out)
 Accel 22 read register function.
 
err_t accel22_check_communication (accel22_t *ctx)
 Accel 22 check communication function.
 
uint8_t accel22_get_int1_pin (accel22_t *ctx)
 Accel 22 get int1 pin function.
 
uint8_t accel22_get_int2_pin (accel22_t *ctx)
 Accel 22 get int2 pin function.
 
err_t accel22_set_filter_config (accel22_t *ctx, accel22_range_t range, accel22_odr_t odr)
 Accel 22 set filter config function.
 
err_t accel22_get_axes (accel22_t *ctx, accel22_axes_t *axes)
 Accel 22 get axes function.
 
err_t accel22_enable_temperature_measurement (accel22_t *ctx)
 Accel 22 enable temperature measurement function.
 
err_t accel22_enable_adc_measurement (accel22_t *ctx)
 Accel 22 enable ADC measurement function.
 
err_t accel22_calibrate_temperature (accel22_t *ctx, float room_temperature)
 Accel 22 calibrate temperature function.
 
err_t accel22_get_temperature (accel22_t *ctx, float *temperature)
 Accel 22 get temperature function.
 
err_t accel22_get_adc (accel22_t *ctx, float *v_adc)
 Accel 22 get adc function.
 

Detailed Description

API for configuring and manipulating Accel 22 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

◆ accel22_calibrate_temperature()

err_t accel22_calibrate_temperature ( accel22_t * ctx,
float room_temperature )

Accel 22 calibrate temperature function.

This function calibrates the temperature readings to the known room temperature in Celsius.

Parameters
[in]ctx: Click context object. See accel22_t object definition for detailed explanation.
[in]room_temperature: Known room temperature in Celsius.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ accel22_cfg_setup()

void accel22_cfg_setup ( accel22_cfg_t * cfg)

Accel 22 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ accel22_check_communication()

err_t accel22_check_communication ( accel22_t * ctx)

Accel 22 check communication function.

This function checks the communication by reading and verifying the device ID bytes.

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

◆ accel22_default_cfg()

err_t accel22_default_cfg ( accel22_t * ctx)

Accel 22 default configuration function.

This function executes a default configuration of Accel 22 click board.

Parameters
[in]ctx: Click context object. See accel22_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.

◆ accel22_drv_interface_selection()

void accel22_drv_interface_selection ( accel22_cfg_t * cfg,
accel22_drv_t drv_sel )

Accel 22 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 accel22_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See accel22_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.

◆ accel22_enable_adc_measurement()

err_t accel22_enable_adc_measurement ( accel22_t * ctx)

Accel 22 enable ADC measurement function.

This function enables the ADC measurement and disables temperature measurement.

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

◆ accel22_enable_temperature_measurement()

err_t accel22_enable_temperature_measurement ( accel22_t * ctx)

Accel 22 enable temperature measurement function.

This function enables the temperature measurement and disables ADC measurement.

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

◆ accel22_generic_read()

err_t accel22_generic_read ( accel22_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Accel 22 data reading function.

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

Parameters
[in]ctx: Click context object. See accel22_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.

◆ accel22_generic_write()

err_t accel22_generic_write ( accel22_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Accel 22 data writing function.

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

Parameters
[in]ctx: Click context object. See accel22_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.

◆ accel22_get_adc()

err_t accel22_get_adc ( accel22_t * ctx,
float * v_adc )

Accel 22 get adc function.

This function reads the ADC voltage.

Parameters
[in]ctx: Click context object. See accel22_t object definition for detailed explanation.
[out]v_adc: ADC voltage read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The ADC measurement must be enabled using accel22_enable_adc_measurement function.

◆ accel22_get_axes()

err_t accel22_get_axes ( accel22_t * ctx,
accel22_axes_t * axes )

Accel 22 get axes function.

This function reads accel X, Y, and Z axis data in mg.

Parameters
[in]ctx: Click context object. See accel22_t object definition for detailed explanation.
[out]axes: X, Y, and Z axis data in mg. See accel22_axes_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ accel22_get_int1_pin()

uint8_t accel22_get_int1_pin ( accel22_t * ctx)

Accel 22 get int1 pin function.

This function returns the interrupt 1 (INT1) pin logic state.

Parameters
[in]ctx: Click context object. See accel22_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ accel22_get_int2_pin()

uint8_t accel22_get_int2_pin ( accel22_t * ctx)

Accel 22 get int2 pin function.

This function returns the interrupt 2 (INT2) pin logic state.

Parameters
[in]ctx: Click context object. See accel22_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ accel22_get_temperature()

err_t accel22_get_temperature ( accel22_t * ctx,
float * temperature )

Accel 22 get temperature function.

This function reads the temperature in Celsius.

Parameters
[in]ctx: Click context object. See accel22_t object definition for detailed explanation.
[out]temperature: Temperature in Celsius.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The temperature measurement must be enabled using accel22_enable_temperature_measurement function.

◆ accel22_init()

err_t accel22_init ( accel22_t * ctx,
accel22_cfg_t * cfg )

Accel 22 initialization function.

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

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

◆ accel22_read_register()

err_t accel22_read_register ( accel22_t * ctx,
uint8_t reg,
uint8_t * data_out )

Accel 22 read register function.

This function reads data from the selected register.

Parameters
[in]ctx: Click context object. See accel22_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.

◆ accel22_set_filter_config()

err_t accel22_set_filter_config ( accel22_t * ctx,
accel22_range_t range,
accel22_odr_t odr )

Accel 22 set filter config function.

This function sets the accel range and output data rate (ODR) bits in FILTER_CTL register.

Parameters
[in]ctx: Click context object. See accel22_t object definition for detailed explanation.
[in]range: Accel range bits setting. See accel22_range_t enum definition for detailed explanation.
[in]odr: Output data rate bits setting. See accel22_odr_t enum definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ accel22_write_register()

err_t accel22_write_register ( accel22_t * ctx,
uint8_t reg,
uint8_t data_in )

Accel 22 write register function.

This function writes a desired data to the selected register.

Parameters
[in]ctx: Click context object. See accel22_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.