accel31
2.1.0.0
|
API for configuring and manipulating Accel 31 Click driver. More...
Modules | |
Accel 31 Registers List | |
List of registers of Accel 31 Click driver. | |
Accel 31 Registers Settings | |
Settings for registers of Accel 31 Click driver. | |
Accel 31 MikroBUS Map | |
MikroBUS pin mapping of Accel 31 Click driver. | |
Functions | |
void | accel31_cfg_setup (accel31_cfg_t *cfg) |
Accel 31 configuration object setup function. More... | |
void | accel31_drv_interface_sel (accel31_cfg_t *cfg, accel31_drv_t drv_sel) |
Accel 31 driver interface setup function. More... | |
err_t | accel31_init (accel31_t *ctx, accel31_cfg_t *cfg) |
Accel 31 initialization function. More... | |
err_t | accel31_default_cfg (accel31_t *ctx) |
Accel 31 default configuration function. More... | |
err_t | accel31_write_reg (accel31_t *ctx, uint8_t reg, uint8_t data_in) |
Accel 31 write reg function. More... | |
err_t | accel31_write_regs (accel31_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
Accel 31 write regs function. More... | |
err_t | accel31_read_reg (accel31_t *ctx, uint8_t reg, uint8_t *data_out) |
Accel 31 read reg function. More... | |
err_t | accel31_read_regs (accel31_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
Accel 31 read regs function. More... | |
uint8_t | accel31_get_int1_pin (accel31_t *ctx) |
Accel 31 get int1 pin function. More... | |
uint8_t | accel31_get_int2_pin (accel31_t *ctx) |
Accel 31 get int2 pin function. More... | |
err_t | accel31_check_communication (accel31_t *ctx) |
Accel 31 check communication function. More... | |
err_t | accel31_sw_reset (accel31_t *ctx) |
Accel 31 sw reset function. More... | |
err_t | accel31_set_accel_odr (accel31_t *ctx, uint8_t odr) |
Accel 31 set accel odr function. More... | |
err_t | accel31_set_accel_fsr (accel31_t *ctx, uint8_t fsr) |
Accel 31 set accel fsr function. More... | |
err_t | accel31_set_temp_odr (accel31_t *ctx, uint8_t odr) |
Accel 31 set temp odr function. More... | |
err_t | accel31_get_accel_drdy (accel31_t *ctx, uint8_t *drdy) |
Accel 31 get accel drdy function. More... | |
err_t | accel31_get_temp_drdy (accel31_t *ctx, uint8_t *drdy) |
Accel 31 get temp drdy function. More... | |
err_t | accel31_get_accel (accel31_t *ctx, accel31_axes_t *accel) |
Accel 31 get accel function. More... | |
err_t | accel31_get_temp (accel31_t *ctx, int8_t *temp) |
Accel 31 get temp function. More... | |
err_t | accel31_get_data (accel31_t *ctx, accel31_data_t *data_out) |
Accel 31 get data function. More... | |
API for configuring and manipulating Accel 31 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void accel31_cfg_setup | ( | accel31_cfg_t * | cfg | ) |
Accel 31 configuration object setup function.
This function initializes Click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See accel31_cfg_t object definition for detailed explanation. |
err_t accel31_check_communication | ( | accel31_t * | ctx | ) |
Accel 31 check communication function.
This function checks the communication by reading and verifying the device ID.
[in] | ctx | : Click context object. See accel31_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t accel31_default_cfg | ( | accel31_t * | ctx | ) |
Accel 31 default configuration function.
This function executes a default configuration of Accel 31 Click board.
[in] | ctx | : Click context object. See accel31_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void accel31_drv_interface_sel | ( | accel31_cfg_t * | cfg, |
accel31_drv_t | drv_sel | ||
) |
Accel 31 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 accel31_cfg_t object definition for detailed explanation. |
[in] | drv_sel | : Driver interface selection. See accel31_drv_t object definition for detailed explanation. |
err_t accel31_get_accel | ( | accel31_t * | ctx, |
accel31_axes_t * | accel | ||
) |
Accel 31 get accel function.
This function reads the accelerometer of X, Y, and Z axis relative to standard gravity (g).
[in] | ctx | : Click context object. See accel31_t object definition for detailed explanation. |
[out] | accel | : Output accelerometer data. See accel31_axes_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t accel31_get_accel_drdy | ( | accel31_t * | ctx, |
uint8_t * | drdy | ||
) |
Accel 31 get accel drdy function.
This function gets the accel new data available flag.
[in] | ctx | : Click context object. See accel31_t object definition for detailed explanation. |
[out] | drdy | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t accel31_get_data | ( | accel31_t * | ctx, |
accel31_data_t * | data_out | ||
) |
Accel 31 get data function.
This function reads the accelerometer and temperature measurement data.
[in] | ctx | : Click context object. See accel31_t object definition for detailed explanation. |
[out] | data_out | : Output data structure read. See accel31_data_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. uint8_t accel31_get_int1_pin | ( | accel31_t * | ctx | ) |
Accel 31 get int1 pin function.
This function returns the interrupt 1 pin logic state.
[in] | ctx | : Click context object. See accel31_t object definition for detailed explanation. |
uint8_t accel31_get_int2_pin | ( | accel31_t * | ctx | ) |
Accel 31 get int2 pin function.
This function returns the interrupt 2 pin logic state.
[in] | ctx | : Click context object. See accel31_t object definition for detailed explanation. |
err_t accel31_get_temp | ( | accel31_t * | ctx, |
int8_t * | temp | ||
) |
Accel 31 get temp function.
This function reads the temperature measurement in degrees Celsius.
[in] | ctx | : Click context object. See accel31_t object definition for detailed explanation. |
[out] | temp | : Temperature in degrees Celsius. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t accel31_get_temp_drdy | ( | accel31_t * | ctx, |
uint8_t * | drdy | ||
) |
Accel 31 get temp drdy function.
This function gets the temperature new data available flag.
[in] | ctx | : Click context object. See accel31_t object definition for detailed explanation. |
[out] | drdy | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t accel31_init | ( | accel31_t * | ctx, |
accel31_cfg_t * | cfg | ||
) |
Accel 31 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
[out] | ctx | : Click context object. See accel31_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See accel31_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t accel31_read_reg | ( | accel31_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out | ||
) |
Accel 31 read reg function.
This function reads a data byte from the selected register.
[in] | ctx | : Click context object. See accel31_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t accel31_read_regs | ( | accel31_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len | ||
) |
Accel 31 read regs function.
This function reads a desired number of data bytes starting from the selected register.
[in] | ctx | : Click context object. See accel31_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. See #err_t definition for detailed explanation. err_t accel31_set_accel_fsr | ( | accel31_t * | ctx, |
uint8_t | fsr | ||
) |
Accel 31 set accel fsr function.
This function sets the accel measurement full scale range.
[in] | ctx | : Click context object. See accel31_t object definition for detailed explanation. |
[in] | fsr | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t accel31_set_accel_odr | ( | accel31_t * | ctx, |
uint8_t | odr | ||
) |
Accel 31 set accel odr function.
This function sets the accel measurement output data rate.
[in] | ctx | : Click context object. See accel31_t object definition for detailed explanation. |
[in] | odr | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t accel31_set_temp_odr | ( | accel31_t * | ctx, |
uint8_t | odr | ||
) |
Accel 31 set temp odr function.
This function sets the temperature measurement output data rate.
[in] | ctx | : Click context object. See accel31_t object definition for detailed explanation. |
[in] | odr | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t accel31_sw_reset | ( | accel31_t * | ctx | ) |
Accel 31 sw reset function.
This function restores the default settings.
[in] | ctx | : Click context object. See accel31_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t accel31_write_reg | ( | accel31_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in | ||
) |
Accel 31 write reg function.
This function writes a data byte to the selected register.
[in] | ctx | : Click context object. See accel31_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t accel31_write_regs | ( | accel31_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len | ||
) |
Accel 31 write regs function.
This function writes a desired number of data bytes starting from the selected register.
[in] | ctx | : Click context object. See accel31_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. See #err_t definition for detailed explanation.