accel29 2.1.0.0
Accel 29 Click Driver

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

Topics

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

Functions

void accel29_cfg_setup (accel29_cfg_t *cfg)
 Accel 29 configuration object setup function.
 
void accel29_drv_interface_selection (accel29_cfg_t *cfg, accel29_drv_t drv_sel)
 Accel 29 driver interface setup function.
 
err_t accel29_init (accel29_t *ctx, accel29_cfg_t *cfg)
 Accel 29 initialization function.
 
err_t accel29_default_cfg (accel29_t *ctx)
 Accel 29 default configuration function.
 
err_t accel29_generic_write (accel29_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Accel 29 data writing function.
 
err_t accel29_generic_read (accel29_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Accel 29 data reading function.
 
err_t accel29_write_register (accel29_t *ctx, uint8_t reg, uint8_t data_in)
 Accel 29 write register function.
 
err_t accel29_read_register (accel29_t *ctx, uint8_t reg, uint8_t *data_out)
 Accel 29 read register function.
 
err_t accel29_check_communication (accel29_t *ctx)
 Accel 29 check communication function.
 
uint8_t accel29_get_int1_pin (accel29_t *ctx)
 Accel 29 get int1 pin function.
 
uint8_t accel29_get_int2_pin (accel29_t *ctx)
 Accel 29 get int2 pin function.
 
err_t accel29_get_axes (accel29_t *ctx, accel29_axes_t *axes)
 Accel 29 get axes function.
 
err_t accel29_get_avg_axes (accel29_t *ctx, uint16_t num_samples, accel29_axes_t *avg_axes)
 Accel 29 get avg axes function.
 
err_t accel29_calibrate_offset (accel29_t *ctx, accel29_axes_t calib_axes)
 Accel 29 calibrate offset function.
 

Detailed Description

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

◆ accel29_calibrate_offset()

err_t accel29_calibrate_offset ( accel29_t * ctx,
accel29_axes_t calib_axes )

Accel 29 calibrate offset function.

This function calibrates accel offset to the specified values by setting the OFSX/Y/Z registers.

Parameters
[in]ctx: Click context object. See accel29_t object definition for detailed explanation.
[out]calib_axes: Calibration X, Y, and Z axis data in g. Axis data should be in a range from -24.96 to 24.765 g. Offset calibrating scale factor is 0.195 g per LSB. See accel29_axes_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ accel29_cfg_setup()

void accel29_cfg_setup ( accel29_cfg_t * cfg)

Accel 29 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ accel29_check_communication()

err_t accel29_check_communication ( accel29_t * ctx)

Accel 29 check communication function.

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

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

◆ accel29_default_cfg()

err_t accel29_default_cfg ( accel29_t * ctx)

Accel 29 default configuration function.

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

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

◆ accel29_drv_interface_selection()

void accel29_drv_interface_selection ( accel29_cfg_t * cfg,
accel29_drv_t drv_sel )

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

◆ accel29_generic_read()

err_t accel29_generic_read ( accel29_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Accel 29 data reading function.

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

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

◆ accel29_generic_write()

err_t accel29_generic_write ( accel29_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Accel 29 data writing function.

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

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

◆ accel29_get_avg_axes()

err_t accel29_get_avg_axes ( accel29_t * ctx,
uint16_t num_samples,
accel29_axes_t * avg_axes )

Accel 29 get avg axes function.

This function reads a specified number of samples for accel X, Y, and Z axis data in g and averages them.

Parameters
[in]ctx: Click context object. See accel29_t object definition for detailed explanation.
[in]num_samples: Number of data samples for averaging.
[out]avg_axes: Average X, Y, and Z axis data in g. See accel29_axes_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ accel29_get_axes()

err_t accel29_get_axes ( accel29_t * ctx,
accel29_axes_t * axes )

Accel 29 get axes function.

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

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

◆ accel29_get_int1_pin()

uint8_t accel29_get_int1_pin ( accel29_t * ctx)

Accel 29 get int1 pin function.

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

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

◆ accel29_get_int2_pin()

uint8_t accel29_get_int2_pin ( accel29_t * ctx)

Accel 29 get int2 pin function.

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

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

◆ accel29_init()

err_t accel29_init ( accel29_t * ctx,
accel29_cfg_t * cfg )

Accel 29 initialization function.

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

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

◆ accel29_read_register()

err_t accel29_read_register ( accel29_t * ctx,
uint8_t reg,
uint8_t * data_out )

Accel 29 read register function.

This function reads data from the selected register.

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

◆ accel29_write_register()

err_t accel29_write_register ( accel29_t * ctx,
uint8_t reg,
uint8_t data_in )

Accel 29 write register function.

This function writes a desired data to the selected register.

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