compass8
2.1.0.0
|
API for configuring and manipulating Compass 8 Click driver. More...
Modules | |
Compass 8 Registers List | |
List of registers of Compass 8 Click driver. | |
Compass 8 Registers Settings | |
Settings for registers of Compass 8 Click driver. | |
Compass 8 MikroBUS Map | |
MikroBUS pin mapping of Compass 8 Click driver. | |
Functions | |
void | compass8_cfg_setup (compass8_cfg_t *cfg) |
Compass 8 configuration object setup function. More... | |
err_t | compass8_init (compass8_t *ctx, compass8_cfg_t *cfg) |
Compass 8 initialization function. More... | |
err_t | compass8_default_cfg (compass8_t *ctx) |
Compass 8 default configuration function. More... | |
void | compass8_device_enable (compass8_t *ctx) |
Compass 8 device enable function. More... | |
void | compass8_device_disable (compass8_t *ctx) |
Compass 8 device disable function. More... | |
err_t | compass8_generic_write (compass8_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
Compass 8 I2C writing function. More... | |
err_t | compass8_generic_read (compass8_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
Compass 8 I2C reading function. More... | |
err_t | compass8_get_company_id (compass8_t *ctx, uint8_t *company_id) |
Compass 8 get company ID function. More... | |
err_t | compass8_get_device_id (compass8_t *ctx, uint8_t *device_id) |
Compass 8 get device ID function. More... | |
err_t | compass8_wait_data_ready (compass8_t *ctx) |
Compass 8 wait data ready function. More... | |
err_t | compass8_get_raw_data (compass8_t *ctx, int16_t *axis_x, int16_t *axis_y, int16_t *axis_z) |
Compass 8 get mag raw data function. More... | |
err_t | compass8_get_magnetic_data (compass8_t *ctx, compass8_axes_t *axis) |
Compass 8 get magnetic data function. More... | |
err_t | compass8_set_operation_mode (compass8_t *ctx, uint8_t op_mode) |
Compass 8 set operation mode function. More... | |
err_t | compass8_get_operation_mode (compass8_t *ctx, uint8_t *op_mode) |
Compass 8 get operation mode function. More... | |
err_t | compass8_set_control (compass8_t *ctx, uint8_t ctrl_reg, uint8_t data_in) |
Compass 8 set control function. More... | |
err_t | compass8_sw_reset (compass8_t *ctx) |
Compass 8 soft reset function. More... | |
API for configuring and manipulating Compass 8 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void compass8_cfg_setup | ( | compass8_cfg_t * | cfg | ) |
Compass 8 configuration object setup function.
This function initializes Click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See compass8_cfg_t object definition for detailed explanation. |
err_t compass8_default_cfg | ( | compass8_t * | ctx | ) |
Compass 8 default configuration function.
This function executes a default configuration of Compass 8 Click board.
[in] | ctx | : Click context object. See compass8_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void compass8_device_disable | ( | compass8_t * | ctx | ) |
Compass 8 device disable function.
This function disable the device.
[in] | ctx | : Click context object. See compass8_t object definition for detailed explanation. |
void compass8_device_enable | ( | compass8_t * | ctx | ) |
Compass 8 device enable function.
This function enabled the device.
[in] | ctx | : Click context object. See compass8_t object definition for detailed explanation. |
err_t compass8_generic_read | ( | compass8_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len | ||
) |
Compass 8 I2C reading function.
This function reads a desired number of data bytes starting from the selected register by using the I2C serial interface.
[in] | ctx | : Click context object. See compass8_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 compass8_generic_write | ( | compass8_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len | ||
) |
Compass 8 I2C writing function.
This function writes a desired number of data bytes starting from the selected register by using the I2C serial interface.
[in] | ctx | : Click context object. See compass8_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. err_t compass8_get_company_id | ( | compass8_t * | ctx, |
uint8_t * | company_id | ||
) |
Compass 8 get company ID function.
This function reads company ID register by using the I2C serial interface.
[in] | ctx | : Click context object. See compass8_t object definition for detailed explanation. |
[out] | company_id | : Company ID [0x48]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t compass8_get_device_id | ( | compass8_t * | ctx, |
uint8_t * | device_id | ||
) |
Compass 8 get device ID function.
This function reads device ID register by using the I2C serial interface.
[in] | ctx | : Click context object. See compass8_t object definition for detailed explanation. |
[out] | device_id | : Device ID [0x0E]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t compass8_get_magnetic_data | ( | compass8_t * | ctx, |
compass8_axes_t * | axis | ||
) |
Compass 8 get magnetic data function.
This function reads the raw magnetic sensor measurement data and calculates magnetic flux density [microTesla] using the I2C serial interface.
[in] | ctx | : Click context object. See compass8_t object definition for detailed explanation. |
[out] | axis | : Magnetic flux density [microTesla]. See compass8_axes_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t compass8_get_operation_mode | ( | compass8_t * | ctx, |
uint8_t * | op_mode | ||
) |
Compass 8 get operation mode function.
This function reads the current operation mode by using the I2C serial interface.
[in] | ctx | : Click context object. See compass8_t object definition for detailed explanation. |
[out] | op_mode | : Operation mode. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t compass8_get_raw_data | ( | compass8_t * | ctx, |
int16_t * | axis_x, | ||
int16_t * | axis_y, | ||
int16_t * | axis_z | ||
) |
Compass 8 get mag raw data function.
This function reads the magnetic measurement raw data by using the I2C serial interface.
[in] | ctx | : Click context object. See compass8_t object definition for detailed explanation. |
[out] | axis_x | : Measurement data of magnetic sensor X-axis. |
[out] | axis_y | : Measurement data of magnetic sensor Y-axis. |
[out] | axis_z | : Measurement data of magnetic sensor Z-axis. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t compass8_init | ( | compass8_t * | ctx, |
compass8_cfg_t * | cfg | ||
) |
Compass 8 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
[out] | ctx | : Click context object. See compass8_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See compass8_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t compass8_set_control | ( | compass8_t * | ctx, |
uint8_t | ctrl_reg, | ||
uint8_t | data_in | ||
) |
Compass 8 set control function.
This function sets the data of the desired control register data by using the I2C serial interface.
[in] | ctx | : Click context object. See compass8_t object definition for detailed explanation. |
[in] | ctrl_reg | : Control register selector. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t compass8_set_operation_mode | ( | compass8_t * | ctx, |
uint8_t | op_mode | ||
) |
Compass 8 set operation mode function.
This function sets the desired sensor operation mode by using the I2C serial interface.
[in] | ctx | : Click context object. See compass8_t object definition for detailed explanation. |
[in] | op_mode | : Operation mode. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t compass8_sw_reset | ( | compass8_t * | ctx | ) |
Compass 8 soft reset function.
This function performs software reset by using the I2C serial interface.
[in] | ctx | : Click context object. See compass8_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t compass8_wait_data_ready | ( | compass8_t * | ctx | ) |
Compass 8 wait data ready function.
This function waits until data is ready by using the I2C serial interface.
[in] | ctx | : Click context object. See compass8_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.