ChibiOS/EX
1.2.0
|
Macros | |
#define | l3gd20GyroscopeGetAxesNumber(devp) gyroscopeGetAxesNumber(&((devp)->gyro_if)) |
Return the number of axes of the BaseGyroscope. More... | |
#define | l3gd20GyroscopeReadRaw(devp, axes) gyroscopeReadRaw(&((devp)->gyro_if), axes) |
Retrieves raw data from the BaseGyroscope. More... | |
#define | l3gd20GyroscopeReadCooked(devp, axes) gyroscopeReadCooked(&((devp)->gyro_if), axes) |
Retrieves cooked data from the BaseGyroscope. More... | |
#define | l3gd20GyroscopeSampleBias(devp) gyroscopeSampleBias(&((devp)->gyro_if)) |
Samples bias values for the BaseGyroscope. More... | |
#define | l3gd20GyroscopeSetBias(devp, bp) gyroscopeSetBias(&((devp)->gyro_if), bp) |
Set bias values for the BaseGyroscope. More... | |
#define | l3gd20GyroscopeResetBias(devp) gyroscopeResetBias(&((devp)->gyro_if)) |
Reset bias values for the BaseGyroscope. More... | |
#define | l3gd20GyroscopeSetSensitivity(devp, sp) gyroscopeSetSensitivity(&((devp)->gyro_if), sp) |
Set sensitivity values for the BaseGyroscope. More... | |
#define | l3gd20GyroscopeResetSensitivity(devp) gyroscopeResetSensitivity(&((devp)->gyro_if)) |
Reset sensitivity values for the BaseGyroscope. More... | |
#define | l3gd20GyroscopeSetFullScale(devp, fs) (devp)->vmt->acc_set_full_scale(devp, fs) |
Changes the L3GD20Driver gyroscope fullscale value. More... | |
Version identification | |
#define | EX_L3GD20_VERSION "1.1.2" |
L3GD20 driver version string. More... | |
#define | EX_L3GD20_MAJOR 1 |
L3GD20 driver version major number. More... | |
#define | EX_L3GD20_MINOR 1 |
L3GD20 driver version minor number. More... | |
#define | EX_L3GD20_PATCH 2 |
L3GD20 driver version patch number. More... | |
#define | L3GD20_GYRO_NUMBER_OF_AXES 3U |
L3GD20 gyroscope system characteristics. More... | |
Configuration options | |
#define | L3GD20_USE_SPI TRUE |
L3GD20 SPI interface switch. More... | |
#define | L3GD20_SHARED_SPI FALSE |
L3GD20 shared SPI switch. More... | |
#define | L3GD20_USE_I2C FALSE |
L3GD20 I2C interface switch. More... | |
#define | L3GD20_SHARED_I2C FALSE |
L3GD20 shared I2C switch. More... | |
#define | L3GD20_USE_ADVANCED FALSE |
L3GD20 advanced configurations switch. More... | |
#define | L3GD20_BIAS_ACQ_TIMES 50 |
Number of acquisitions for bias removal. More... | |
#define | L3GD20_BIAS_SETTLING_US 5000 |
Settling time for bias removal. More... | |
L3GD20 data structures and types. | |
enum | l3gd20_fs_t { L3GD20_FS_250DPS = 0x00, L3GD20_FS_500DPS = 0x10, L3GD20_FS_2000DPS = 0x20 } |
L3GD20 full scale. More... | |
enum | l3gd20_odr_t { L3GD20_ODR_95HZ = 0x00, L3GD20_ODR_190HZ = 0x40, L3GD20_ODR_380HZ = 0x80, L3GD20_ODR_760HZ = 0xC0 } |
L3GD20 output data rate and bandwidth. More... | |
enum | l3gd20_bw_t { L3GD20_BW0 = 0x00, L3GD20_BW1 = 0x40, L3GD20_BW2 = 0x80, L3GD20_BW3 = 0xC0 } |
L3GD20 low pass filter 1 bandwidth. More... | |
enum | l3gd20_bdu_t { L3GD20_BDU_CONTINUOUS = 0x00, L3GD20_BDU_BLOCKED = 0x80 } |
L3GD20 block data update. More... | |
enum | l3gd20_hpm_t { L3GD20_HPM_NORMAL = 0x00, L3GD20_HPM_REFERENCE = 0x10, L3GD20_HPM_AUTORESET = 0x30, L3GD20_HPM_BYPASSED = 0xFF } |
L3GD20 HP filter mode. More... | |
enum | l3gd20_hpcf_t { L3GD20_HPCF_0 = 0x00, L3GD20_HPCF_1 = 0x01, L3GD20_HPCF_2 = 0x02, L3GD20_HPCF_3 = 0x03, L3GD20_HPCF_4 = 0x04, L3GD20_HPCF_5 = 0x05, L3GD20_HPCF_6 = 0x06, L3GD20_HPCF_7 = 0x07, L3GD20_HPCF_8 = 0x08, L3GD20_HPCF_9 = 0x09 } |
L3GD20 HP configuration. More... | |
enum | l3gd20_lp2m_t { L3GD20_LP2M_ON = 0x00, L3GD20_LP2M_BYPASSED = 0xFF } |
L3GD20 LP2 filter mode. More... | |
enum | l3gd20_end_t { L3GD20_END_LITTLE = 0x00, L3GD20_END_BIG = 0x40 } |
L3GD20 endianness. More... | |
enum | l3gd20_state_t { L3GD20_UNINIT = 0, L3GD20_STOP = 1, L3GD20_READY = 2 } |
Driver state machine possible states. More... | |
typedef struct L3GD20Driver | L3GD20Driver |
Structure representing a L3GD20 driver. More... | |
#define | _l3gd20_methods_alone |
L3GD20 specific methods. More... | |
#define | _l3gd20_methods |
L3GD20 specific methods with inherited ones. More... | |
#define | _l3gd20_data |
L3GD20Driver specific data. More... | |
Data Structures | |
struct | L3GD20Config |
L3GD20 configuration structure. More... | |
struct | L3GD20VMT |
L3GD20 virtual methods table. More... | |
struct | L3GD20Driver |
L3GD20 3-axis gyroscope class. More... | |
Functions | |
static void | l3gd20SPIReadRegister (SPIDriver *spip, uint8_t reg, size_t n, uint8_t *b) |
Reads a generic register value using SPI. More... | |
static void | l3gd20SPIWriteRegister (SPIDriver *spip, uint8_t reg, size_t n, uint8_t *b) |
Writes a value into a generic register using SPI. More... | |
static size_t | gyro_get_axes_number (void *ip) |
Return the number of axes of the BaseGyroscope. More... | |
static msg_t | gyro_read_raw (void *ip, int32_t axes[L3GD20_GYRO_NUMBER_OF_AXES]) |
Retrieves raw data from the BaseGyroscope. More... | |
static msg_t | gyro_read_cooked (void *ip, float axes[]) |
Retrieves cooked data from the BaseGyroscope. More... | |
static msg_t | gyro_sample_bias (void *ip) |
Samples bias values for the BaseGyroscope. More... | |
static msg_t | gyro_set_bias (void *ip, float *bp) |
Set bias values for the BaseGyroscope. More... | |
static msg_t | gyro_reset_bias (void *ip) |
Reset bias values for the BaseGyroscope. More... | |
static msg_t | gyro_set_sensivity (void *ip, float *sp) |
Set sensitivity values for the BaseGyroscope. More... | |
static msg_t | gyro_reset_sensivity (void *ip) |
Reset sensitivity values for the BaseGyroscope. More... | |
static msg_t | gyro_set_full_scale (L3GD20Driver *devp, l3gd20_fs_t fs) |
Changes the L3GD20Driver gyroscope fullscale value. More... | |
void | l3gd20ObjectInit (L3GD20Driver *devp) |
Initializes an instance. More... | |
void | l3gd20Start (L3GD20Driver *devp, const L3GD20Config *config) |
Configures and activates L3GD20 Complex Driver peripheral. More... | |
void | l3gd20Stop (L3GD20Driver *devp) |
Deactivates the L3GD20 Complex Driver peripheral. More... | |
#define EX_L3GD20_VERSION "1.1.2" |
#define EX_L3GD20_MAJOR 1 |
#define EX_L3GD20_MINOR 1 |
#define EX_L3GD20_PATCH 2 |
#define L3GD20_GYRO_NUMBER_OF_AXES 3U |
#define L3GD20_USE_SPI TRUE |
#define L3GD20_SHARED_SPI FALSE |
#define L3GD20_USE_I2C FALSE |
#define L3GD20_SHARED_I2C FALSE |
#define L3GD20_USE_ADVANCED FALSE |
#define L3GD20_BIAS_ACQ_TIMES 50 |
#define L3GD20_BIAS_SETTLING_US 5000 |
#define _l3gd20_methods_alone |
L3GD20
specific methods.
#define _l3gd20_methods |
#define _l3gd20_data |
L3GD20Driver
specific data.
#define l3gd20GyroscopeGetAxesNumber | ( | devp | ) | gyroscopeGetAxesNumber(&((devp)->gyro_if)) |
Return the number of axes of the BaseGyroscope.
[in] | devp | pointer to L3GD20Driver . |
#define l3gd20GyroscopeReadRaw | ( | devp, | |
axes | |||
) | gyroscopeReadRaw(&((devp)->gyro_if), axes) |
Retrieves raw data from the BaseGyroscope.
[in] | devp | pointer to L3GD20Driver . |
[out] | axes | a buffer which would be filled with raw data. |
MSG_OK | if the function succeeded. |
#define l3gd20GyroscopeReadCooked | ( | devp, | |
axes | |||
) | gyroscopeReadCooked(&((devp)->gyro_if), axes) |
Retrieves cooked data from the BaseGyroscope.
[in] | devp | pointer to L3GD20Driver . |
[out] | axes | a buffer which would be filled with cooked data. |
MSG_OK | if the function succeeded. |
#define l3gd20GyroscopeSampleBias | ( | devp | ) | gyroscopeSampleBias(&((devp)->gyro_if)) |
Samples bias values for the BaseGyroscope.
L3GD20_BIAS_ACQ_TIMES
and L3GD20_BIAS_SETTLING_US
.[in] | devp | pointer to L3GD20Driver . |
MSG_OK | if the function succeeded. |
#define l3gd20GyroscopeSetBias | ( | devp, | |
bp | |||
) | gyroscopeSetBias(&((devp)->gyro_if), bp) |
Set bias values for the BaseGyroscope.
[in] | devp | pointer to L3GD20Driver . |
[in] | bp | a buffer which contains biases. |
MSG_OK | if the function succeeded. |
#define l3gd20GyroscopeResetBias | ( | devp | ) | gyroscopeResetBias(&((devp)->gyro_if)) |
Reset bias values for the BaseGyroscope.
[in] | devp | pointer to L3GD20Driver . |
MSG_OK | if the function succeeded. |
#define l3gd20GyroscopeSetSensitivity | ( | devp, | |
sp | |||
) | gyroscopeSetSensitivity(&((devp)->gyro_if), sp) |
Set sensitivity values for the BaseGyroscope.
[in] | devp | pointer to L3GD20Driver . |
[in] | sp | a buffer which contains sensitivities. |
MSG_OK | if the function succeeded. |
#define l3gd20GyroscopeResetSensitivity | ( | devp | ) | gyroscopeResetSensitivity(&((devp)->gyro_if)) |
Reset sensitivity values for the BaseGyroscope.
[in] | devp | pointer to L3GD20Driver . |
MSG_OK | if the function succeeded. |
MSG_RESET | otherwise. |
#define l3gd20GyroscopeSetFullScale | ( | devp, | |
fs | |||
) | (devp)->vmt->acc_set_full_scale(devp, fs) |
Changes the L3GD20Driver gyroscope fullscale value.
[in] | devp | pointer to L3GD20Driver . |
[in] | fs | new fullscale value. |
MSG_OK | if the function succeeded. |
MSG_RESET | otherwise. |
typedef struct L3GD20Driver L3GD20Driver |
enum l3gd20_fs_t |
enum l3gd20_odr_t |
enum l3gd20_bw_t |
enum l3gd20_bdu_t |
enum l3gd20_hpm_t |
enum l3gd20_hpcf_t |
L3GD20 HP configuration.
enum l3gd20_lp2m_t |
enum l3gd20_end_t |
enum l3gd20_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 consecutive registers to read |
[in] | b | pointer to an output buffer. |
Definition at line 59 of file l3gd20.c.
Referenced by gyro_read_raw().
|
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 78 of file l3gd20.c.
Referenced by l3gd20Stop().
|
static |
Return the number of axes of the BaseGyroscope.
[in] | ip | pointer to BaseGyroscope interface. |
Definition at line 96 of file l3gd20.c.
References L3GD20_GYRO_NUMBER_OF_AXES.
|
static |
Retrieves raw data from the BaseGyroscope.
[in] | ip | pointer to BaseGyroscope interface. |
[out] | axes | a buffer which would be filled with raw data. |
MSG_OK | if the function succeeded. |
Definition at line 115 of file l3gd20.c.
References L3GD20_GYRO_NUMBER_OF_AXES, L3GD20_READY, and l3gd20SPIReadRegister().
Referenced by gyro_read_cooked(), and gyro_sample_bias().
|
static |
Retrieves cooked data from the BaseGyroscope.
[in] | ip | pointer to BaseGyroscope interface. |
[out] | axes | a buffer which would be filled with cooked data. |
MSG_OK | if the function succeeded. |
Definition at line 167 of file l3gd20.c.
References gyro_read_raw(), L3GD20_GYRO_NUMBER_OF_AXES, and L3GD20_READY.
|
static |
Samples bias values for the BaseGyroscope.
L3GD20_BIAS_ACQ_TIMES
and L3GD20_BIAS_SETTLING_US
.[in] | ip | pointer to BaseGyroscope interface. |
MSG_OK | if the function succeeded. |
Definition at line 200 of file l3gd20.c.
References gyro_read_raw(), L3GD20_BIAS_ACQ_TIMES, L3GD20_BIAS_SETTLING_US, L3GD20_GYRO_NUMBER_OF_AXES, and L3GD20_READY.
|
static |
Set bias values for the BaseGyroscope.
[in] | ip | pointer to BaseGyroscope interface. |
[in] | bp | a buffer which contains biases. |
MSG_OK | if the function succeeded. |
Definition at line 248 of file l3gd20.c.
References L3GD20_GYRO_NUMBER_OF_AXES, and L3GD20_READY.
|
static |
Reset bias values for the BaseGyroscope.
[in] | ip | pointer to BaseGyroscope interface. |
MSG_OK | if the function succeeded. |
Definition at line 277 of file l3gd20.c.
References L3GD20_GYRO_NUMBER_OF_AXES, and L3GD20_READY.
|
static |
Set sensitivity values for the BaseGyroscope.
[in] | ip | pointer to BaseGyroscope interface. |
[in] | sp | a buffer which contains sensitivities. |
MSG_OK | if the function succeeded. |
Definition at line 307 of file l3gd20.c.
References L3GD20_GYRO_NUMBER_OF_AXES, and L3GD20_READY.
|
static |
Reset sensitivity values for the BaseGyroscope.
[in] | ip | pointer to BaseGyroscope interface. |
MSG_OK | if the function succeeded. |
MSG_RESET | otherwise. |
Definition at line 336 of file l3gd20.c.
References L3GD20_FS_250DPS, L3GD20_GYRO_NUMBER_OF_AXES, and L3GD20_READY.
|
static |
Changes the L3GD20Driver gyroscope fullscale value.
[in] | devp | pointer to BaseGyroscope interface. |
[in] | fs | new fullscale value. |
MSG_OK | if the function succeeded. |
MSG_RESET | otherwise. |
Definition at line 378 of file l3gd20.c.
References L3GD20_FS_250DPS, and L3GD20_READY.
void l3gd20ObjectInit | ( | L3GD20Driver * | devp | ) |
Initializes an instance.
[out] | devp | pointer to the L3GD20Driver object |
Definition at line 473 of file l3gd20.c.
References L3GD20Driver::vmt.
void l3gd20Start | ( | L3GD20Driver * | devp, |
const L3GD20Config * | config | ||
) |
Configures and activates L3GD20 Complex Driver peripheral.
[in] | devp | pointer to the L3GD20Driver object |
[in] | config | pointer to the L3GD20Config object |
Definition at line 490 of file l3gd20.c.
References L3GD20_READY, and L3GD20_STOP.
void l3gd20Stop | ( | L3GD20Driver * | devp | ) |
Deactivates the L3GD20 Complex Driver peripheral.
[in] | devp | pointer to the L3GD20Driver object |
Definition at line 613 of file l3gd20.c.
References L3GD20_READY, L3GD20_STOP, and l3gd20SPIWriteRegister().