ChibiOS/EX
1.1.2
|
![]() |
Version identification | |
#define | EX_LIS3DSH_VERSION "1.1.2" |
LIS3DSH driver version string. More... | |
#define | EX_LIS3DSH_MAJOR 1 |
LIS3DSH driver version major number. More... | |
#define | EX_LIS3DSH_MINOR 1 |
LIS3DSH driver version minor number. More... | |
#define | EX_LIS3DSH_PATCH 2 |
LIS3DSH driver version patch number. More... | |
#define | LIS3DSH_ACC_NUMBER_OF_AXES 3U |
LIS3DSH accelerometer subsystem characteristics. More... | |
Configuration options | |
#define | LIS3DSH_USE_SPI TRUE |
LIS3DSH SPI interface switch. More... | |
#define | LIS3DSH_SHARED_SPI FALSE |
LIS3DSH shared SPI switch. More... | |
#define | LIS3DSH_USE_I2C FALSE |
LIS3DSH I2C interface switch. More... | |
#define | LIS3DSH_SHARED_I2C FALSE |
LIS3DSH shared I2C switch. More... | |
#define | LIS3DSH_USE_ADVANCED FALSE |
LIS3DSH advanced configurations switch. More... | |
LIS3DSH data structures and types | |
| |
typedef struct LIS3DSHDriver | LIS3DSHDriver |
Structure representing a LIS3DSH driver. More... | |
#define | _lis3dsh_methods_alone |
LIS3DSH specific methods. More... | |
#define | _lis3dsh_methods |
LIS3DSH specific methods with inherited ones. More... | |
#define | _lis3dsh_data |
LIS3DSHDriver specific data. More... | |
Data Structures | |
struct | LIS3DSHConfig |
LIS3DSH configuration structure. More... | |
struct | LIS3DSHVMT |
LIS3DSH virtual methods table. More... | |
struct | LIS3DSHDriver |
LIS3DSH 3-axis accelerometer class. More... | |
Functions | |
static void | lis3dshSPIReadRegister (SPIDriver *spip, uint8_t reg, size_t n, uint8_t *b) |
Reads a generic register value using SPI. More... | |
static void | lis3dshSPIWriteRegister (SPIDriver *spip, uint8_t reg, size_t n, uint8_t *b) |
Writes a value into a generic register using SPI. More... | |
static size_t | acc_get_axes_number (void *ip) |
Return the number of axes of the BaseAccelerometer. More... | |
static msg_t | acc_read_raw (void *ip, int32_t axes[]) |
Retrieves raw data from the BaseAccelerometer. More... | |
static msg_t | acc_read_cooked (void *ip, float axes[]) |
Retrieves cooked data from the BaseAccelerometer. More... | |
static msg_t | acc_set_bias (void *ip, float *bp) |
Set bias values for the BaseAccelerometer. More... | |
static msg_t | acc_reset_bias (void *ip) |
Reset bias values for the BaseAccelerometer. More... | |
static msg_t | acc_set_sensivity (void *ip, float *sp) |
Set sensitivity values for the BaseAccelerometer. More... | |
static msg_t | acc_reset_sensivity (void *ip) |
Reset sensitivity values for the BaseAccelerometer. More... | |
static msg_t | acc_set_full_scale (LIS3DSHDriver *devp, lis3dsh_acc_fs_t fs) |
Changes the LIS3DSHDriver accelerometer fullscale value. More... | |
void | lis3dshObjectInit (LIS3DSHDriver *devp) |
Initializes an instance. More... | |
void | lis3dshStart (LIS3DSHDriver *devp, const LIS3DSHConfig *config) |
Configures and activates LIS3DSH Complex Driver peripheral. More... | |
void | lis3dshStop (LIS3DSHDriver *devp) |
Deactivates the LIS3DSH Complex Driver peripheral. More... | |
#define EX_LIS3DSH_VERSION "1.1.2" |
#define EX_LIS3DSH_MAJOR 1 |
#define EX_LIS3DSH_MINOR 1 |
#define EX_LIS3DSH_PATCH 2 |
#define LIS3DSH_ACC_NUMBER_OF_AXES 3U |
LIS3DSH accelerometer subsystem characteristics.
Definition at line 72 of file lis3dsh.h.
Referenced by acc_get_axes_number(), acc_read_cooked(), acc_read_raw(), acc_reset_bias(), acc_reset_sensivity(), acc_set_bias(), acc_set_full_scale(), acc_set_sensivity(), lis3dshObjectInit(), and lis3dshStart().
#define LIS3DSH_USE_SPI TRUE |
#define LIS3DSH_SHARED_SPI FALSE |
#define LIS3DSH_USE_I2C FALSE |
#define LIS3DSH_SHARED_I2C FALSE |
#define LIS3DSH_USE_ADVANCED FALSE |
#define _lis3dsh_methods_alone |
LIS3DSH
specific methods.
#define _lis3dsh_methods |
LIS3DSH
specific methods with inherited ones.
#define _lis3dsh_data |
LIS3DSHDriver
specific data.
#define lis3dshAccelerometerGetAxesNumber | ( | devp | ) | accelerometerGetAxesNumber(&((devp)->acc_if)) |
Return the number of axes of the BaseAccelerometer.
[in] | devp | pointer to LIS3DSHDriver . |
#define lis3dshAccelerometerReadRaw | ( | devp, | |
axes | |||
) | accelerometerReadRaw(&((devp)->acc_if), axes) |
Retrieves raw data from the BaseAccelerometer.
[in] | devp | pointer to LIS3DSHDriver . |
[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 lis3dshAccelerometerReadCooked | ( | devp, | |
axes | |||
) | accelerometerReadCooked(&((devp)->acc_if), axes) |
Retrieves cooked data from the BaseAccelerometer.
[in] | devp | pointer to LIS3DSHDriver . |
[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 lis3dshAccelerometerSetBias | ( | devp, | |
bp | |||
) | accelerometerSetBias(&((devp)->acc_if), bp) |
Set bias values for the BaseAccelerometer.
[in] | devp | pointer to LIS3DSHDriver . |
[in] | bp | a buffer which contains biases. |
MSG_OK | if the function succeeded. |
#define lis3dshAccelerometerResetBias | ( | devp | ) | accelerometerResetBias(&((devp)->acc_if)) |
Reset bias values for the BaseAccelerometer.
[in] | devp | pointer to LIS3DSHDriver . |
MSG_OK | if the function succeeded. |
#define lis3dshAccelerometerSetSensitivity | ( | devp, | |
sp | |||
) | accelerometerSetSensitivity(&((devp)->acc_if), sp) |
Set sensitivity values for the BaseAccelerometer.
[in] | devp | pointer to LIS3DSHDriver . |
[in] | sp | a buffer which contains sensitivities. |
MSG_OK | if the function succeeded. |
#define lis3dshAccelerometerResetSensitivity | ( | devp | ) | accelerometerResetSensitivity(&((devp)->acc_if)) |
Reset sensitivity values for the BaseAccelerometer.
[in] | devp | pointer to LIS3DSHDriver . |
MSG_OK | if the function succeeded. |
MSG_RESET | otherwise. |
#define lis3dshAccelerometerSetFullScale | ( | devp, | |
fs | |||
) | (devp)->vmt->acc_set_full_scale(devp, fs) |
Changes the LIS3DSHDriver accelerometer fullscale value.
[in] | devp | pointer to LIS3DSHDriver . |
[in] | fs | new fullscale value. |
MSG_OK | if the function succeeded. |
MSG_RESET | otherwise. |
typedef struct LIS3DSHDriver LIS3DSHDriver |
enum lis3dsh_acc_fs_t |
enum lis3dsh_acc_odr_t |
LIS3DSH output data rate.
enum lis3dsh_acc_bw_t |
enum lis3dsh_acc_bdu_t |
enum lis3dsh_state_t |
|
static |
Reads a generic register value using SPI.
[in] | spip | pointer to the SPI interface |
[in] | reg | starting register address |
[in] | n | number of adjacent registers to write |
[in] | b | pointer to a buffer. |
Definition at line 60 of file lis3dsh.c.
Referenced by acc_read_raw(), and acc_set_full_scale().
|
static |
Writes a value into a generic register using SPI.
[in] | spip | pointer to the SPI interface |
[in] | reg | starting register address |
[in] | n | number of adjacent registers to write |
[in] | b | pointer to a buffer of values. |
Definition at line 80 of file lis3dsh.c.
Referenced by acc_set_full_scale(), lis3dshStart(), and lis3dshStop().
|
static |
Return the number of axes of the BaseAccelerometer.
[in] | ip | pointer to BaseAccelerometer interface. |
Definition at line 98 of file lis3dsh.c.
References LIS3DSH_ACC_NUMBER_OF_AXES.
Referenced by acc_set_full_scale().
|
static |
Retrieves raw data from the BaseAccelerometer.
[in] | ip | pointer to BaseAccelerometer 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 120 of file lis3dsh.c.
References LIS3DSH_ACC_NUMBER_OF_AXES, LIS3DSH_READY, and lis3dshSPIReadRegister().
Referenced by acc_read_cooked(), and acc_set_full_scale().
|
static |
Retrieves cooked data from the BaseAccelerometer.
[in] | ip | pointer to BaseAccelerometer 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 176 of file lis3dsh.c.
References acc_read_raw(), LIS3DSH_ACC_NUMBER_OF_AXES, and LIS3DSH_READY.
Referenced by acc_set_full_scale().
|
static |
Set bias values for the BaseAccelerometer.
[in] | ip | pointer to BaseAccelerometer interface. |
[in] | bp | a buffer which contains biases. |
MSG_OK | if the function succeeded. |
Definition at line 209 of file lis3dsh.c.
References LIS3DSH_ACC_NUMBER_OF_AXES, and LIS3DSH_READY.
Referenced by acc_set_full_scale().
|
static |
Reset bias values for the BaseAccelerometer.
[in] | ip | pointer to BaseAccelerometer interface. |
MSG_OK | if the function succeeded. |
Definition at line 238 of file lis3dsh.c.
References LIS3DSH_ACC_NUMBER_OF_AXES, and LIS3DSH_READY.
Referenced by acc_set_full_scale().
|
static |
Set sensitivity values for the BaseAccelerometer.
[in] | ip | pointer to BaseAccelerometer interface. |
[in] | sp | a buffer which contains sensitivities. |
MSG_OK | if the function succeeded. |
Definition at line 268 of file lis3dsh.c.
References LIS3DSH_ACC_NUMBER_OF_AXES, and LIS3DSH_READY.
Referenced by acc_set_full_scale().
|
static |
Reset sensitivity values for the BaseAccelerometer.
[in] | ip | pointer to BaseAccelerometer interface. |
MSG_OK | if the function succeeded. |
MSG_RESET | otherwise. |
Definition at line 297 of file lis3dsh.c.
References LIS3DSH_ACC_FS_16G, LIS3DSH_ACC_FS_2G, LIS3DSH_ACC_FS_4G, LIS3DSH_ACC_FS_6G, LIS3DSH_ACC_FS_8G, LIS3DSH_ACC_NUMBER_OF_AXES, and LIS3DSH_READY.
Referenced by acc_set_full_scale().
|
static |
Changes the LIS3DSHDriver accelerometer fullscale value.
[in] | devp | pointer to LIS3DSHDriver interface. |
[in] | fs | new fullscale value. |
MSG_OK | if the function succeeded. |
MSG_RESET | otherwise. |
Definition at line 346 of file lis3dsh.c.
References acc_get_axes_number(), acc_read_cooked(), acc_read_raw(), acc_reset_bias(), acc_reset_sensivity(), acc_set_bias(), acc_set_sensivity(), LIS3DSH_ACC_FS_16G, LIS3DSH_ACC_FS_2G, LIS3DSH_ACC_FS_4G, LIS3DSH_ACC_FS_6G, LIS3DSH_ACC_FS_8G, LIS3DSH_ACC_NUMBER_OF_AXES, LIS3DSH_READY, lis3dshSPIReadRegister(), and lis3dshSPIWriteRegister().
void lis3dshObjectInit | ( | LIS3DSHDriver * | devp | ) |
Initializes an instance.
[out] | devp | pointer to the LIS3DSHDriver object |
Definition at line 448 of file lis3dsh.c.
References LIS3DSHDriver::acc_if, LIS3DSH_ACC_NUMBER_OF_AXES, LIS3DSH_STOP, BaseAccelerometer::vmt, and LIS3DSHDriver::vmt.
void lis3dshStart | ( | LIS3DSHDriver * | devp, |
const LIS3DSHConfig * | config | ||
) |
Configures and activates LIS3DSH Complex Driver peripheral.
[in] | devp | pointer to the LIS3DSHDriver object |
[in] | config | pointer to the LIS3DSHConfig object |
Definition at line 467 of file lis3dsh.c.
References LIS3DSH_ACC_FS_16G, LIS3DSH_ACC_FS_2G, LIS3DSH_ACC_FS_4G, LIS3DSH_ACC_FS_6G, LIS3DSH_ACC_FS_8G, LIS3DSH_ACC_NUMBER_OF_AXES, LIS3DSH_READY, LIS3DSH_STOP, and lis3dshSPIWriteRegister().
void lis3dshStop | ( | LIS3DSHDriver * | devp | ) |
Deactivates the LIS3DSH Complex Driver peripheral.
[in] | devp | pointer to the LIS3DSHDriver object |
Definition at line 613 of file lis3dsh.c.
References LIS3DSH_READY, LIS3DSH_STOP, and lis3dshSPIWriteRegister().