accel24 2.1.0.0
Accel 24 Click Driver

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

Topics

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

Functions

void accel24_cfg_setup (accel24_cfg_t *cfg)
 Accel 24 configuration object setup function.
 
err_t accel24_init (accel24_t *ctx, accel24_cfg_t *cfg)
 Accel 24 initialization function.
 
err_t accel24_default_cfg (accel24_t *ctx)
 Accel 24 default configuration function.
 
err_t accel24_generic_write (accel24_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Accel 24 I2C writing function.
 
err_t accel24_generic_read (accel24_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Accel 24 I2C reading function.
 
err_t accel24_write_register (accel24_t *ctx, uint8_t reg, uint8_t data_in)
 Accel 24 write register function.
 
err_t accel24_read_register (accel24_t *ctx, uint8_t reg, uint8_t *data_out)
 Accel 24 read register function.
 
err_t accel24_check_communication (accel24_t *ctx)
 Accel 24 check communication function.
 
uint8_t accel24_get_int_pin (accel24_t *ctx)
 Accel 24 get int pin function.
 
err_t accel24_soft_reset (accel24_t *ctx)
 Accel 24 soft reset function.
 
err_t accel24_set_full_scale_range (accel24_t *ctx, uint8_t fsr)
 Accel 24 set full scale range function.
 
err_t accel24_read_data (accel24_t *ctx, accel24_data_t *data_out)
 Accel 24 read data function.
 

Detailed Description

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

◆ accel24_cfg_setup()

void accel24_cfg_setup ( accel24_cfg_t * cfg)

Accel 24 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ accel24_check_communication()

err_t accel24_check_communication ( accel24_t * ctx)

Accel 24 check communication function.

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

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

◆ accel24_default_cfg()

err_t accel24_default_cfg ( accel24_t * ctx)

Accel 24 default configuration function.

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

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

◆ accel24_generic_read()

err_t accel24_generic_read ( accel24_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Accel 24 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 accel24_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 (up to 16 bytes).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ accel24_generic_write()

err_t accel24_generic_write ( accel24_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Accel 24 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 accel24_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 (up to 16 bytes).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ accel24_get_int_pin()

uint8_t accel24_get_int_pin ( accel24_t * ctx)

Accel 24 get int pin function.

This function returns the INT pin logic state.

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

◆ accel24_init()

err_t accel24_init ( accel24_t * ctx,
accel24_cfg_t * cfg )

Accel 24 initialization function.

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

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

◆ accel24_read_data()

err_t accel24_read_data ( accel24_t * ctx,
accel24_data_t * data_out )

Accel 24 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 accel24_t object definition for detailed explanation.
[out]data_out: Output data read. See accel24_data_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ accel24_read_register()

err_t accel24_read_register ( accel24_t * ctx,
uint8_t reg,
uint8_t * data_out )

Accel 24 read register function.

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

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

◆ accel24_set_full_scale_range()

err_t accel24_set_full_scale_range ( accel24_t * ctx,
uint8_t fsr )

Accel 24 set full scale range function.

This function sets the full scale range resolution.

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

◆ accel24_soft_reset()

err_t accel24_soft_reset ( accel24_t * ctx)

Accel 24 soft reset function.

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

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

◆ accel24_write_register()

err_t accel24_write_register ( accel24_t * ctx,
uint8_t reg,
uint8_t data_in )

Accel 24 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 accel24_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.