accel16 2.0.0.0
Accel 16 Click Driver

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

Topics

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

Functions

void accel16_cfg_setup (accel16_cfg_t *cfg)
 Accel 16 configuration object setup function.
 
err_t accel16_init (accel16_t *ctx, accel16_cfg_t *cfg)
 Accel 16 initialization function.
 
err_t accel16_default_cfg (accel16_t *ctx)
 Accel 16 default configuration function.
 
err_t accel16_multiple_reg_write (accel16_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Write multiple registers.
 
err_t accel16_single_reg_write (accel16_t *ctx, uint8_t reg, uint8_t data_in)
 Write single register.
 
err_t accel16_multiple_reg_read (accel16_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Read multiple registers.
 
err_t accel16_single_reg_read (accel16_t *ctx, uint8_t reg, uint8_t *data_out)
 Read single registers.
 
err_t accel16_fifo_read (accel16_t *ctx, uint8_t *data_out, uint16_t len)
 Read fifo.
 
uint8_t accel16_get_interrupt_1 (accel16_t *ctx)
 Get interrupt 1 state.
 
uint8_t accel16_get_interrupt_2 (accel16_t *ctx)
 Get interrupt 2 state.
 
err_t accel16_filter_configuration (accel16_t *ctx, accel16_gain_t gain, accel16_output_rate_t odr)
 Filter configuration.
 
err_t accel16_get_axes (accel16_t *ctx, accel16_axes_t *axes)
 Get axes data.
 
err_t accel16_get_temperature (accel16_t *ctx, float *temperature)
 Get temperature data.
 
err_t accel16_get_adc (accel16_t *ctx, float *v_adc)
 Get adc data.
 
err_t accel16_calibrate_temperature (accel16_t *ctx, float room_temperature)
 Accel 16 calibrate temperature function.
 

Detailed Description

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

◆ accel16_calibrate_temperature()

err_t accel16_calibrate_temperature ( accel16_t * ctx,
float room_temperature )

Accel 16 calibrate temperature function.

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

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

◆ accel16_cfg_setup()

void accel16_cfg_setup ( accel16_cfg_t * cfg)

Accel 16 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ accel16_default_cfg()

err_t accel16_default_cfg ( accel16_t * ctx)

Accel 16 default configuration function.

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

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

◆ accel16_fifo_read()

err_t accel16_fifo_read ( accel16_t * ctx,
uint8_t * data_out,
uint16_t len )

Read fifo.

This function reads a desired number of data bytes from fifo buffer.

Parameters
[in]ctx: Click context object. See accel16_t object definition for detailed explanation.
[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
You should always read even number of bytes from fifo.

◆ accel16_filter_configuration()

err_t accel16_filter_configuration ( accel16_t * ctx,
accel16_gain_t gain,
accel16_output_rate_t odr )

Filter configuration.

This function changes configuration of filter register of gain and output data rate.

Parameters
[in,out]ctx: Click context object. See accel16_t object definition for detailed explanation.
[in]gain: Data resolution.
[in]odr: Output data rate.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.

◆ accel16_get_adc()

err_t accel16_get_adc ( accel16_t * ctx,
float * v_adc )

Get adc data.

This function reads adc data from register and calculates voltage level.

Parameters
[in]ctx: Click context object. See accel16_t object definition for detailed explanation.
[out]v_adc: Voltage output data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
ADC read data range is from 10% to 90% of VCC[ 0.33V-2.97V ].

◆ accel16_get_axes()

err_t accel16_get_axes ( accel16_t * ctx,
accel16_axes_t * axes )

Get axes data.

This function reads axes data from registers and calculates values in g.

Parameters
[in]ctx: Click context object. See accel16_t object definition for detailed explanation.
[out]axes: Axes data. See accel16_axes_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.

◆ accel16_get_interrupt_1()

uint8_t accel16_get_interrupt_1 ( accel16_t * ctx)

Get interrupt 1 state.

This function reads int1 pin state.

Parameters
[in]ctx: Click context object. See accel16_t object definition for detailed explanation.
Returns
Interrupt 1 pin state

◆ accel16_get_interrupt_2()

uint8_t accel16_get_interrupt_2 ( accel16_t * ctx)

Get interrupt 2 state.

This function reads int2 pin state.

Parameters
[in]ctx: Click context object. See accel16_t object definition for detailed explanation.
Returns
Interrupt 2 pin state

◆ accel16_get_temperature()

err_t accel16_get_temperature ( accel16_t * ctx,
float * temperature )

Get temperature data.

This function reads temperature data from registers and calculates values in degreese C.

Parameters
[in]ctx: Click context object. See accel16_t object definition for detailed explanation.
[out]temperature: Temperature data in degreese Celsius.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.

◆ accel16_init()

err_t accel16_init ( accel16_t * ctx,
accel16_cfg_t * cfg )

Accel 16 initialization function.

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

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

◆ accel16_multiple_reg_read()

err_t accel16_multiple_reg_read ( accel16_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Read multiple registers.

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

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

◆ accel16_multiple_reg_write()

err_t accel16_multiple_reg_write ( accel16_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Write multiple registers.

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

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

◆ accel16_single_reg_read()

err_t accel16_single_reg_read ( accel16_t * ctx,
uint8_t reg,
uint8_t * data_out )

Read single registers.

This function reads a byte from the selected register.

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

◆ accel16_single_reg_write()

err_t accel16_single_reg_write ( accel16_t * ctx,
uint8_t reg,
uint8_t data_in )

Write single register.

This function writes a bytes to the selected register.

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