accel20 2.0.0.0
|
API for configuring and manipulating Accel 20 Click driver. More...
Topics | |
Accel 20 Registers List | |
List of registers of Accel 20 Click driver. | |
Accel 20 Registers Settings | |
Settings for registers of Accel 20 Click driver. | |
Accel 20 MikroBUS Map | |
MikroBUS pin mapping of Accel 20 Click driver. | |
Functions | |
void | accel20_cfg_setup (accel20_cfg_t *cfg) |
Accel 20 configuration object setup function. | |
void | accel20_drv_interface_selection (accel20_cfg_t *cfg, accel20_drv_t drv_sel) |
Accel 20 driver interface setup function. | |
err_t | accel20_init (accel20_t *ctx, accel20_cfg_t *cfg) |
Accel 20 initialization function. | |
err_t | accel20_default_cfg (accel20_t *ctx) |
Accel 20 default configuration function. | |
err_t | accel20_generic_write (accel20_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
Accel 20 data writing function. | |
err_t | accel20_generic_read (accel20_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
Accel 20 data reading function. | |
err_t | accel20_soft_reset (accel20_t *ctx) |
Accel 20 soft reset function. | |
err_t | accel20_check_id (accel20_t *ctx) |
Accel 20 check ID function. | |
uint8_t | accel20_data_ready (accel20_t *ctx) |
Accel 20 check data ready function. | |
err_t | accel20_set_operating_mode (accel20_t *ctx, uint8_t op_mode) |
Accel 20 set operating mode function. | |
err_t | accel20_enable_int_1_pin (accel20_t *ctx) |
Accel 20 enable INT 1 pin function. | |
err_t | accel20_enable_int_2_pin (accel20_t *ctx) |
Accel 20 enable INT 2 pin function. | |
err_t | accel20_set_accel_range (accel20_t *ctx, uint8_t range) |
Accel 20 set accel range function. | |
err_t | accel20_set_output_data_rate (accel20_t *ctx, uint8_t odr) |
Accel 20 set output data rate function. | |
err_t | accel20_get_axis_data (accel20_t *ctx, accel20_axis_t *axis) |
Accel 20 get accelerometer axis function. | |
err_t | accel20_set_trigger (accel20_t *ctx, uint8_t en_trg) |
Accel 20 set trigger function. | |
uint8_t | accel20_get_int_1 (accel20_t *ctx) |
Accel 20 get Interrupt 1 function. | |
uint8_t | accel20_get_int_2 (accel20_t *ctx) |
Accel 20 get Interrupt 2 function. | |
API for configuring and manipulating Accel 20 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void accel20_cfg_setup | ( | accel20_cfg_t * | cfg | ) |
Accel 20 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See accel20_cfg_t object definition for detailed explanation. |
err_t accel20_check_id | ( | accel20_t * | ctx | ) |
Accel 20 check ID function.
This function check device ID and communication of the KX134 tri-axis ±8g, ±16g, ±32g, ±64g silicon micromachined accelerometer on the Accel 20 Click board™.
[in] | ctx | : Click context object. See accel20_t object definition for detailed explanation. |
0
- Communication OK, -1
- Communication Error.uint8_t accel20_data_ready | ( | accel20_t * | ctx | ) |
Accel 20 check data ready function.
This function check data ready interrupt reporte of the KX134 tri-axis ±8g, ±16g, ±32g, ±64g silicon micromachined accelerometer on the Accel 20 Click board™.
[in] | ctx | : Click context object. See accel20_t object definition for detailed explanation. |
0
- Data is ready, -1
- Data is not ready.err_t accel20_default_cfg | ( | accel20_t * | ctx | ) |
Accel 20 default configuration function.
This function executes a default configuration of Accel 20 click board.
[in] | ctx | : Click context object. See accel20_t object definition for detailed explanation. |
0
- Success, -1
- Error.void accel20_drv_interface_selection | ( | accel20_cfg_t * | cfg, |
accel20_drv_t | drv_sel ) |
Accel 20 driver interface setup function.
This function sets a serial driver interface which will be used further in the click driver.
[out] | cfg | : Click configuration structure. See accel20_cfg_t object definition for detailed explanation. |
[in] | drv_sel | : Driver interface selection. See accel20_drv_t object definition for detailed explanation. |
err_t accel20_enable_int_1_pin | ( | accel20_t * | ctx | ) |
Accel 20 enable INT 1 pin function.
This function enable I1 ( INT ) pin data 2 ready interrupt reported of the KX134 tri-axis ±8g, ±16g, ±32g, ±64g silicon micromachined accelerometer on the Accel 20 Click board™.
[in] | ctx | : Click context object. See accel20_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t accel20_enable_int_2_pin | ( | accel20_t * | ctx | ) |
Accel 20 enable INT 2 pin function.
This function enable I2 ( AN ) pin data 2 ready interrupt reported of the KX134 tri-axis ±8g, ±16g, ±32g, ±64g silicon micromachined accelerometer on the Accel 20 Click board™.
[in] | ctx | : Click context object. See accel20_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t accel20_generic_read | ( | accel20_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len ) |
Accel 20 data reading function.
This function reads a desired number of data bytes starting from the selected register.
[in] | ctx | : Click context object. See accel20_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. |
0
- Success, -1
- Error.err_t accel20_generic_write | ( | accel20_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len ) |
Accel 20 data writing function.
This function writes a desired number of data bytes starting from the selected register.
[in] | ctx | : Click context object. See accel20_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. |
0
- Success, -1
- Error.err_t accel20_get_axis_data | ( | accel20_t * | ctx, |
accel20_axis_t * | axis ) |
Accel 20 get accelerometer axis function.
This function get accelerometer data of the KX134 tri-axis ±8g, ±16g, ±32g, ±64g silicon micromachined accelerometer on the Accel 20 Click board™.
[in] | ctx | : Click context object. See accel20_t object definition for detailed explanation. |
[out] | axis | : An object that contains X , Y and Z axis data. |
0
- Success, -1
- Error.uint8_t accel20_get_int_1 | ( | accel20_t * | ctx | ) |
Accel 20 get Interrupt 1 function.
This function get states of the Interrupt 1 ( INT pin ) of the KX134 tri-axis ±8g, ±16g, ±32g, ±64g silicon micromachined accelerometer on the Accel 20 Click board™.
[in] | ctx | : Click context object. See accel20_t object definition for detailed explanation. |
0
- Low pin state, -1
- High pin state.uint8_t accel20_get_int_2 | ( | accel20_t * | ctx | ) |
Accel 20 get Interrupt 2 function.
This function get states of the Interrupt 2 ( AN pin ) of the KX134 tri-axis ±8g, ±16g, ±32g, ±64g silicon micromachined accelerometer on the Accel 20 Click board™.
[in] | ctx | : Click context object. See accel20_t object definition for detailed explanation. |
0
- Low pin state, -1
- High pin state.err_t accel20_init | ( | accel20_t * | ctx, |
accel20_cfg_t * | cfg ) |
Accel 20 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See accel20_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See accel20_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t accel20_set_accel_range | ( | accel20_t * | ctx, |
uint8_t | range ) |
Accel 20 set accel range function.
This function sets accel G-range of the KX134 tri-axis ±8g, ±16g, ±32g, ±64g silicon micromachined accelerometer on the Accel 20 Click board™.
[in] | ctx | : Click context object. See accel20_t object definition for detailed explanation. |
[in] | range | : Acceleration range:
|
0
- Success, -1
- Error.err_t accel20_set_operating_mode | ( | accel20_t * | ctx, |
uint8_t | op_mode ) |
Accel 20 set operating mode function.
This function sets operating mode of the KX134 tri-axis ±8g, ±16g, ±32g, ±64g silicon micromachined accelerometer on the Accel 20 Click board™.
[in] | ctx | : Click context object. See accel20_t object definition for detailed explanation. |
[in] | op_mode | : Operating mode:
|
0
- Success, -1
- Error.err_t accel20_set_output_data_rate | ( | accel20_t * | ctx, |
uint8_t | odr ) |
Accel 20 set output data rate function.
This function sets output data rate of the KX134 tri-axis ±8g, ±16g, ±32g, ±64g silicon micromachined accelerometer on the Accel 20 Click board™.
[in] | ctx | : Click context object. See accel20_t object definition for detailed explanation. |
[in] | odr | : Acceleration odr:
|
0
- Success, -1
- Error.err_t accel20_set_trigger | ( | accel20_t * | ctx, |
uint8_t | en_trg ) |
Accel 20 set trigger function.
This function set trigger, FIFO buffer control of the KX134 tri-axis ±8g, ±16g, ±32g, ±64g silicon micromachined accelerometer on the Accel 20 Click board™.
[in] | ctx | : Click context object. See accel20_t object definition for detailed explanation. |
[in] | en_trg | :
|
0
- Success, -1
- Error.err_t accel20_soft_reset | ( | accel20_t * | ctx | ) |
Accel 20 soft reset function.
This function executes a software reset of the KX134 tri-axis ±8g, ±16g, ±32g, ±64g silicon micromachined accelerometer on the Accel 20 Click board™.
[in] | ctx | : Click context object. See accel20_t object definition for detailed explanation. |
0
- Success, -1
- Error.