accel25 2.1.0.0
Accel 25 Click Driver

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

Topics

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

Functions

void accel25_cfg_setup (accel25_cfg_t *cfg)
 Accel 25 configuration object setup function.
 
err_t accel25_init (accel25_t *ctx, accel25_cfg_t *cfg)
 Accel 25 initialization function.
 
err_t accel25_default_cfg (accel25_t *ctx)
 Accel 25 default configuration function.
 
err_t accel25_generic_write (accel25_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Accel 25 I2C writing function.
 
err_t accel25_generic_read (accel25_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Accel 25 I2C reading function.
 
err_t accel25_write_register (accel25_t *ctx, uint8_t reg, uint8_t data_in)
 Accel 25 write register function.
 
err_t accel25_read_register (accel25_t *ctx, uint8_t reg, uint8_t *data_out)
 Accel 25 read register function.
 
err_t accel25_check_communication (accel25_t *ctx)
 Accel 25 check communication function.
 
uint8_t accel25_get_int_pin (accel25_t *ctx)
 Accel 25 get int pin function.
 
err_t accel25_soft_reset (accel25_t *ctx)
 Accel 25 soft reset function.
 
err_t accel25_set_full_scale_range (accel25_t *ctx, uint8_t fsr)
 Accel 25 set full scale range function.
 
err_t accel25_read_data (accel25_t *ctx, accel25_data_t *data_out)
 Accel 25 read data function.
 

Detailed Description

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

◆ accel25_cfg_setup()

void accel25_cfg_setup ( accel25_cfg_t * cfg)

Accel 25 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ accel25_check_communication()

err_t accel25_check_communication ( accel25_t * ctx)

Accel 25 check communication function.

This function checks the communication by reading and verifying the who am I register.

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

◆ accel25_default_cfg()

err_t accel25_default_cfg ( accel25_t * ctx)

Accel 25 default configuration function.

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

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

◆ accel25_generic_read()

err_t accel25_generic_read ( accel25_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Accel 25 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

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

◆ accel25_generic_write()

err_t accel25_generic_write ( accel25_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Accel 25 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

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

◆ accel25_get_int_pin()

uint8_t accel25_get_int_pin ( accel25_t * ctx)

Accel 25 get int pin function.

This function returns the INT pin logic state.

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

◆ accel25_init()

err_t accel25_init ( accel25_t * ctx,
accel25_cfg_t * cfg )

Accel 25 initialization function.

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

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

◆ accel25_read_data()

err_t accel25_read_data ( accel25_t * ctx,
accel25_data_t * data_out )

Accel 25 read data function.

This function checks the data ready bit, clears it, and then reads the accel (X, Y, Z) and temperature measurements.

Parameters
[in]ctx: Click context object. See accel25_t object definition for detailed explanation.
[out]data_out: Output data read. See accel25_data_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ accel25_read_register()

err_t accel25_read_register ( accel25_t * ctx,
uint8_t reg,
uint8_t * data_out )

Accel 25 read register function.

This function reads data from the selected register by using I2C serial interface.

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

◆ accel25_set_full_scale_range()

err_t accel25_set_full_scale_range ( accel25_t * ctx,
uint8_t fsr )

Accel 25 set full scale range function.

This function sets the full scale range resolution.

Parameters
[in]ctx: Click context object. See accel25_t object definition for detailed explanation.
[in]fsr: Full-scale range
  • 0 - 2G,
  • 1 - 4G,
  • 2 - 8G.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ accel25_soft_reset()

err_t accel25_soft_reset ( accel25_t * ctx)

Accel 25 soft reset function.

This function performs the software reset by setting the SW RST bit.

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

◆ accel25_write_register()

err_t accel25_write_register ( accel25_t * ctx,
uint8_t reg,
uint8_t data_in )

Accel 25 write register function.

This function writes a desired data to the selected register by using I2C serial interface.

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