|
ChibiOS
0.0.0
|
|
Macros | |
| #define | lis3mdlCompassGetAxesNumber(devp) compassGetAxesNumber(&((devp)->comp_if)) |
| Return the number of axes of the BaseCompass. More... | |
| #define | lis3mdlCompassReadRaw(devp, axes) compassReadRaw(&((devp)->comp_if), axes) |
| Retrieves raw data from the BaseCompass. More... | |
| #define | lis3mdlCompassReadCooked(devp, axes) compassReadCooked(&((devp)->comp_if), axes) |
| Retrieves cooked data from the BaseCompass. More... | |
| #define | lis3mdlCompassSetBias(devp, bp) compassSetBias(&((devp)->comp_if), bp) |
| Set bias values for the BaseCompass. More... | |
| #define | lis3mdlCompassResetBias(devp) compassResetBias(&((devp)->comp_if)) |
| Reset bias values for the BaseCompass. More... | |
| #define | lis3mdlCompassSetSensitivity(devp, sp) compassSetSensitivity(&((devp)->comp_if), sp) |
| Set sensitivity values for the BaseCompass. More... | |
| #define | lis3mdlCompassResetSensitivity(devp) compassResetSensitivity(&((devp)->comp_if)) |
| Reset sensitivity values for the BaseCompass. More... | |
| #define | lis3mdlCompassSetFullScale(devp, fs) (devp)->vmt->comp_set_full_scale(devp, fs) |
| Changes the LIS3MDLDriver compass fullscale value. More... | |
Version identification | |
| #define | EX_LIS3MDL_VERSION "1.1.1" |
| LIS3MDL driver version string. More... | |
| #define | EX_LIS3MDL_MAJOR 1 |
| LIS3MDL driver version major number. More... | |
| #define | EX_LIS3MDL_MINOR 1 |
| LIS3MDL driver version minor number. More... | |
| #define | EX_LIS3MDL_PATCH 1 |
| LIS3MDL driver version patch number. More... | |
| #define | LIS3MDL_COMP_NUMBER_OF_AXES 3U |
| LIS3MDL compass subsystem characteristics. More... | |
LIS3MDL_CTRL_REG4 register bits definitions | |
| #define | LIS3MDL_CTRL_REG4_MASK 0x0E |
| #define | LIS3MDL_CTRL_REG4_BLE (1 << 1) |
| #define | LIS3MDL_CTRL_REG4_OMZ0 (1 << 2) |
| #define | LIS3MDL_CTRL_REG4_OMZ1 (1 << 3) |
LIS3MDL_CTRL_REG5 register bits definitions | |
| #define | LIS3MDL_CTRL_REG5_MASK 0xC0 |
| #define | LIS3MDL_CTRL_REG5_BDU (1 << 6) |
| #define | LIS3MDL_CTRL_REG5_FAST_READ (1 << 7) |
Configuration options | |
| #define | LIS3MDL_USE_SPI FALSE |
| LIS3MDL SPI interface switch. More... | |
| #define | LIS3MDL_SHARED_SPI FALSE |
| LIS3MDL shared SPI switch. More... | |
| #define | LIS3MDL_USE_I2C TRUE |
| LIS3MDL I2C interface switch. More... | |
| #define | LIS3MDL_SHARED_I2C FALSE |
| LIS3MDL shared I2C switch. More... | |
| #define | LIS3MDL_COMP_USE_ADVANCED FALSE |
| LIS3MDL advanced configurations switch. More... | |
LIS3MDL data structures and types | |
| |
| typedef struct LIS3MDLDriver | LIS3MDLDriver |
| LIS3MDL slave address. More... | |
| #define | _lis3msl_methods_alone |
LIS3MDL specific methods. More... | |
| #define | _lis3mdl_methods |
LIS3MDL specific methods with inherited ones. More... | |
| #define | _lis3mdl_data |
LIS3MDLDriver specific data. More... | |
Data Structures | |
| struct | LIS3MDLConfig |
| LIS3MDL configuration structure. More... | |
| struct | LIS3MDLVMT |
LIS3MDL virtual methods table. More... | |
| struct | LIS3MDLDriver |
| LIS3MDL 3-axis compass class. More... | |
Functions | |
| msg_t | lis3mdlI2CReadRegister (I2CDriver *i2cp, lis3mdl_sad_t sad, uint8_t reg, uint8_t *rxbuf, size_t n) |
| Reads registers value using I2C. More... | |
| msg_t | lis3mdlI2CWriteRegister (I2CDriver *i2cp, lis3mdl_sad_t sad, uint8_t *txbuf, uint8_t n) |
| Writes a value into a register using I2C. More... | |
| static size_t | comp_get_axes_number (void *ip) |
| Return the number of axes of the BaseCompass. More... | |
| static msg_t | comp_read_raw (void *ip, int32_t axes[]) |
| Retrieves raw data from the BaseCompass. More... | |
| static msg_t | comp_read_cooked (void *ip, float axes[]) |
| Retrieves cooked data from the BaseCompass. More... | |
| static msg_t | comp_set_bias (void *ip, float *bp) |
| Set bias values for the BaseCompass. More... | |
| static msg_t | comp_reset_bias (void *ip) |
| Reset bias values for the BaseCompass. More... | |
| static msg_t | comp_set_sensivity (void *ip, float *sp) |
| Set sensitivity values for the BaseCompass. More... | |
| static msg_t | comp_reset_sensivity (void *ip) |
| Reset sensitivity values for the BaseCompass. More... | |
| static msg_t | comp_set_full_scale (LIS3MDLDriver *devp, lis3mdl_comp_fs_t fs) |
| Changes the LIS3MDLDriver compass fullscale value. More... | |
| void | lis3mdlObjectInit (LIS3MDLDriver *devp) |
| Initializes an instance. More... | |
| void | lis3mdlStart (LIS3MDLDriver *devp, const LIS3MDLConfig *config) |
| Configures and activates LIS3MDL Complex Driver peripheral. More... | |
| void | lis3mdlStop (LIS3MDLDriver *devp) |
| Deactivates the LIS3MDL Complex Driver peripheral. More... | |
| #define EX_LIS3MDL_VERSION "1.1.1" |
| #define EX_LIS3MDL_MAJOR 1 |
| #define EX_LIS3MDL_MINOR 1 |
| #define EX_LIS3MDL_PATCH 1 |
| #define LIS3MDL_COMP_NUMBER_OF_AXES 3U |
LIS3MDL compass subsystem characteristics.
Definition at line 70 of file lis3mdl.h.
Referenced by comp_get_axes_number(), comp_read_cooked(), comp_read_raw(), comp_reset_bias(), comp_reset_sensivity(), comp_set_bias(), comp_set_full_scale(), comp_set_sensivity(), lis3mdlObjectInit(), and lis3mdlStart().
| #define LIS3MDL_USE_SPI FALSE |
| #define LIS3MDL_SHARED_SPI FALSE |
| #define LIS3MDL_USE_I2C TRUE |
| #define LIS3MDL_SHARED_I2C FALSE |
| #define LIS3MDL_COMP_USE_ADVANCED FALSE |
| #define _lis3msl_methods_alone |
LIS3MDL specific methods.
| #define _lis3mdl_methods |
LIS3MDL specific methods with inherited ones.
| #define _lis3mdl_data |
LIS3MDLDriver specific data.
| #define lis3mdlCompassGetAxesNumber | ( | devp | ) | compassGetAxesNumber(&((devp)->comp_if)) |
Return the number of axes of the BaseCompass.
| [in] | devp | pointer to LIS3MDLDriver. |
| #define lis3mdlCompassReadRaw | ( | devp, | |
| axes | |||
| ) | compassReadRaw(&((devp)->comp_if), axes) |
Retrieves raw data from the BaseCompass.
| [in] | devp | pointer to BaseCompass interface. |
| [out] | axes | a buffer which would be filled with raw data. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | if one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors(). |
| MSG_TIMEOUT | if a timeout occurred before operation end. |
| #define lis3mdlCompassReadCooked | ( | devp, | |
| axes | |||
| ) | compassReadCooked(&((devp)->comp_if), axes) |
Retrieves cooked data from the BaseCompass.
| [in] | devp | pointer to BaseCompass interface. |
| [out] | axes | a buffer which would be filled with cooked data. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | if one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors(). |
| MSG_TIMEOUT | if a timeout occurred before operation end. |
| #define lis3mdlCompassSetBias | ( | devp, | |
| bp | |||
| ) | compassSetBias(&((devp)->comp_if), bp) |
Set bias values for the BaseCompass.
| [in] | devp | pointer to BaseCompass interface. |
| [in] | bp | a buffer which contains biases. |
| MSG_OK | if the function succeeded. |
| #define lis3mdlCompassResetBias | ( | devp | ) | compassResetBias(&((devp)->comp_if)) |
Reset bias values for the BaseCompass.
| [in] | devp | pointer to LIS3MDLDriver. |
| MSG_OK | if the function succeeded. |
| #define lis3mdlCompassSetSensitivity | ( | devp, | |
| sp | |||
| ) | compassSetSensitivity(&((devp)->comp_if), sp) |
Set sensitivity values for the BaseCompass.
| [in] | devp | pointer to LIS3MDLDriver. |
| [in] | sp | a buffer which contains sensitivities. |
| MSG_OK | if the function succeeded. |
| #define lis3mdlCompassResetSensitivity | ( | devp | ) | compassResetSensitivity(&((devp)->comp_if)) |
Reset sensitivity values for the BaseCompass.
| [in] | devp | pointer to LIS3MDLDriver. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | otherwise. |
| #define lis3mdlCompassSetFullScale | ( | devp, | |
| fs | |||
| ) | (devp)->vmt->comp_set_full_scale(devp, fs) |
Changes the LIS3MDLDriver compass fullscale value.
| [in] | devp | pointer to LIS3MDLDriver. |
| [in] | fs | new fullscale value. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | otherwise. |
| typedef struct LIS3MDLDriver LIS3MDLDriver |
| enum lis3mdl_sad_t |
| enum lis3mdl_comp_fs_t |
| enum lis3mdl_comp_odr_t |
LIS3MDL output data rate.
| enum lis3mdl_comp_lp_t |
| enum lis3mdl_comp_md_t |
| enum lis3mdl_comp_omxy_t |
| enum lis3mdl_comp_omz_t |
| enum lis3mdl_temp_t |
| enum lis3mdl_bdu_t |
| enum lis3mdl_end_t |
| enum lis3mdl_state_t |
| msg_t lis3mdlI2CReadRegister | ( | I2CDriver * | i2cp, |
| lis3mdl_sad_t | sad, | ||
| uint8_t | reg, | ||
| uint8_t * | rxbuf, | ||
| size_t | n | ||
| ) |
Reads registers value using I2C.
| [in] | i2cp | pointer to the I2C interface |
| [in] | sad | slave address without R bit |
| [in] | reg | first sub-register address |
| [out] | rxbuf | pointer to an output buffer |
| [in] | n | number of consecutive register to read |
Definition at line 62 of file lis3mdl.c.
References i2cMasterTransmitTimeout(), and TIME_INFINITE.
Referenced by comp_read_raw(), and comp_set_full_scale().

| msg_t lis3mdlI2CWriteRegister | ( | I2CDriver * | i2cp, |
| lis3mdl_sad_t | sad, | ||
| uint8_t * | txbuf, | ||
| uint8_t | n | ||
| ) |
Writes a value into a register using I2C.
| [in] | i2cp | pointer to the I2C interface |
| [in] | sad | slave address without R bit |
| [in] | txbuf | buffer containing sub-address value in first position and values to write |
| [in] | n | size of txbuf less one (not considering the first element) |
Definition at line 85 of file lis3mdl.c.
References i2cMasterTransmitTimeout(), and TIME_INFINITE.
Referenced by comp_set_full_scale(), lis3mdlStart(), and lis3mdlStop().

|
static |
Return the number of axes of the BaseCompass.
| [in] | ip | pointer to BaseCompass interface |
Definition at line 102 of file lis3mdl.c.
References LIS3MDL_COMP_NUMBER_OF_AXES, and osalDbgCheck.
Referenced by comp_set_full_scale().
|
static |
Retrieves raw data from the BaseCompass.
| [in] | ip | pointer to BaseCompass interface. |
| [out] | axes | a buffer which would be filled with raw data. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | if one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors(). |
| MSG_TIMEOUT | if a timeout occurred before operation end. |
Definition at line 124 of file lis3mdl.c.
References I2C_READY, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), LIS3MDL_COMP_NUMBER_OF_AXES, LIS3MDL_READY, lis3mdlI2CReadRegister(), MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.
Referenced by comp_read_cooked(), and comp_set_full_scale().

|
static |
Retrieves cooked data from the BaseCompass.
| [in] | ip | pointer to BaseCompass interface. |
| [out] | axes | a buffer which would be filled with cooked data. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | if one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors(). |
| MSG_TIMEOUT | if a timeout occurred before operation end. |
Definition at line 178 of file lis3mdl.c.
References comp_read_raw(), LIS3MDL_COMP_NUMBER_OF_AXES, LIS3MDL_READY, objGetInstance, osalDbgAssert, and osalDbgCheck.
Referenced by comp_set_full_scale().

|
static |
Set bias values for the BaseCompass.
| [in] | ip | pointer to BaseCompass interface. |
| [in] | bp | a buffer which contains biases. |
| MSG_OK | if the function succeeded. |
Definition at line 212 of file lis3mdl.c.
References LIS3MDL_COMP_NUMBER_OF_AXES, LIS3MDL_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.
Referenced by comp_set_full_scale().
|
static |
Reset bias values for the BaseCompass.
| [in] | ip | pointer to BaseCompass interface. |
| MSG_OK | if the function succeeded. |
Definition at line 241 of file lis3mdl.c.
References LIS3MDL_COMP_NUMBER_OF_AXES, LIS3MDL_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.
Referenced by comp_set_full_scale().
|
static |
Set sensitivity values for the BaseCompass.
| [in] | ip | pointer to BaseCompass interface. |
| [in] | sp | a buffer which contains sensitivities. |
| MSG_OK | if the function succeeded. |
Definition at line 271 of file lis3mdl.c.
References LIS3MDL_COMP_NUMBER_OF_AXES, LIS3MDL_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.
Referenced by comp_set_full_scale().
|
static |
Reset sensitivity values for the BaseCompass.
| [in] | ip | pointer to BaseCompass interface. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | otherwise. |
Definition at line 300 of file lis3mdl.c.
References FALSE, LIS3MDL_COMP_FS_12GA, LIS3MDL_COMP_FS_16GA, LIS3MDL_COMP_FS_4GA, LIS3MDL_COMP_FS_8GA, LIS3MDL_COMP_NUMBER_OF_AXES, LIS3MDL_READY, MSG_OK, MSG_RESET, objGetInstance, osalDbgAssert, and osalDbgCheck.
Referenced by comp_set_full_scale().
|
static |
Changes the LIS3MDLDriver compass fullscale value.
| [in] | devp | pointer to LIS3MDLDriver interface. |
| [in] | fs | new fullscale value. |
| MSG_OK | if the function succeeded. |
| MSG_RESET | otherwise. |
Definition at line 345 of file lis3mdl.c.
References comp_get_axes_number(), comp_read_cooked(), comp_read_raw(), comp_reset_bias(), comp_reset_sensivity(), comp_set_bias(), comp_set_sensivity(), I2C_READY, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), LIS3MDL_COMP_FS_12GA, LIS3MDL_COMP_FS_16GA, LIS3MDL_COMP_FS_4GA, LIS3MDL_COMP_FS_8GA, LIS3MDL_COMP_NUMBER_OF_AXES, LIS3MDL_READY, lis3mdlI2CReadRegister(), lis3mdlI2CWriteRegister(), MSG_OK, MSG_RESET, osalDbgAssert, and osalDbgCheck.

| void lis3mdlObjectInit | ( | LIS3MDLDriver * | devp | ) |
Initializes an instance.
| [out] | devp | pointer to the LIS3MDLDriver object |
Definition at line 446 of file lis3mdl.c.
References LIS3MDLDriver::comp_if, LIS3MDL_COMP_NUMBER_OF_AXES, LIS3MDL_STOP, BaseCompass::vmt, and LIS3MDLDriver::vmt.
| void lis3mdlStart | ( | LIS3MDLDriver * | devp, |
| const LIS3MDLConfig * | config | ||
| ) |
Configures and activates LIS3MDL Complex Driver peripheral.
| [in] | devp | pointer to the LIS3MDLDriver object |
| [in] | config | pointer to the LIS3MDLConfig object |
Definition at line 465 of file lis3mdl.c.
References I2CDriver::config, FALSE, i2cAcquireBus(), LIS3MDLConfig::i2cp, i2cReleaseBus(), i2cStart(), LIS3MDL_COMP_FS_12GA, LIS3MDL_COMP_FS_16GA, LIS3MDL_COMP_FS_4GA, LIS3MDL_COMP_FS_8GA, LIS3MDL_COMP_NUMBER_OF_AXES, LIS3MDL_READY, LIS3MDL_STOP, lis3mdlI2CWriteRegister(), osalDbgAssert, osalDbgCheck, and osalThreadSleepMilliseconds.

| void lis3mdlStop | ( | LIS3MDLDriver * | devp | ) |
Deactivates the LIS3MDL Complex Driver peripheral.
| [in] | devp | pointer to the LIS3MDLDriver object |
Definition at line 598 of file lis3mdl.c.
References i2cAcquireBus(), i2cReleaseBus(), i2cStart(), i2cStop(), LIS3MDL_READY, LIS3MDL_STOP, lis3mdlI2CWriteRegister(), osalDbgAssert, and osalDbgCheck.
