Updated L3GD20 driver to v 1.0.5 (Fixing Bug #915).

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11442 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
Rocco Marco Guglielmi 2018-02-05 10:31:52 +00:00
parent 4ddc3c188b
commit 2268a0e69a
2 changed files with 90 additions and 91 deletions

View File

@ -304,17 +304,11 @@ static msg_t set_full_scale(void *ip, l3gd20_fs_t fs) {
return MSG_OK;
}
static const struct BaseSensorVMT vmt_basesensor = {
static const struct BaseSensorVMT vmt_sensor = {
get_axes_number, read_raw, read_cooked
};
static const struct BaseGyroscopeVMT vmt_basegyroscope = {
get_axes_number, read_raw, read_cooked,
sample_bias, set_bias, reset_bias,
set_sensivity, reset_sensivity
};
static const struct L3GD20VMT vmt_l3gd20 = {
static const struct L3GD20GyroscopeVMT vmt_gyroscope = {
get_axes_number, read_raw, read_cooked,
sample_bias, set_bias, reset_bias,
set_sensivity, reset_sensivity,
@ -334,9 +328,8 @@ static const struct L3GD20VMT vmt_l3gd20 = {
*/
void l3gd20ObjectInit(L3GD20Driver *devp) {
uint32_t i;
devp->vmt_basesensor = &vmt_basesensor;
devp->vmt_basegyroscope = &vmt_basegyroscope;
devp->vmt_l3gd20 = &vmt_l3gd20;
devp->vmt_sensor = &vmt_sensor;
devp->vmt_gyroscope = &vmt_gyroscope;
devp->config = NULL;
for(i = 0; i < L3GD20_NUMBER_OF_AXES; i++)
devp->bias[i] = 0.0f;

View File

@ -42,7 +42,7 @@
/**
* @brief L3GD20 driver version string.
*/
#define EX_L3GD20_VERSION "1.0.4"
#define EX_L3GD20_VERSION "1.0.5"
/**
* @brief L3GD20 driver version major number.
@ -57,7 +57,7 @@
/**
* @brief L3GD20 driver version patch number.
*/
#define EX_L3GD20_PATCH 4
#define EX_L3GD20_PATCH 5
/** @} */
/**
@ -80,12 +80,12 @@
* @name L3GD20 communication interfaces related bit masks
* @{
*/
#define L3GD20_DI_MASK 0xFF /**< Data In mask */
#define L3GD20_DI(n) (1 << n) /**< Data In bit n */
#define L3GD20_AD_MASK 0x3F /**< Address Data mask */
#define L3GD20_AD(n) (1 << n) /**< Address Data bit n */
#define L3GD20_MS (1 << 6) /**< Multiple read write */
#define L3GD20_RW (1 << 7) /**< Read Write selector */
#define L3GD20_DI_MASK 0xFF
#define L3GD20_DI(n) (1 << n)
#define L3GD20_AD_MASK 0x3F
#define L3GD20_AD(n) (1 << n)
#define L3GD20_MS (1 << 6)
#define L3GD20_RW (1 << 7)
/** @} */
/**
@ -474,25 +474,26 @@ typedef struct {
} L3GD20Config;
/**
* @brief Structure representing a L3GD20 driver.
* @brief @p L3GD20 gyroscope subsystem specific methods.
*/
typedef struct L3GD20Driver L3GD20Driver;
/**
* @brief @p L3GD20 specific methods.
*/
#define _l3gd20_methods \
_base_gyroscope_methods \
#define _l3gd20_gyroscope_methods_alone \
/* Change full scale value of L3GD20.*/ \
msg_t (*set_full_scale)(void *instance, l3gd20_fs_t fs);
/**
* @brief @p L3GD20 specific methods.
*/
#define _l3gd20_gyroscope_methods \
_base_gyroscope_methods \
_l3gd20_gyroscope_methods_alone
/**
* @extends BaseGyroscopeVMT
*
* @brief @p L3GD20 virtual methods table.
* @brief @p L3GD20 gyroscope virtual methods table.
*/
struct L3GD20VMT {
_l3gd20_methods
struct L3GD20GyroscopeVMT {
_l3gd20_gyroscope_methods
};
/**
@ -520,13 +521,18 @@ struct L3GD20VMT {
*/
struct L3GD20Driver {
/** @brief BaseSensor Virtual Methods Table. */
const struct BaseSensorVMT *vmt_basesensor;
/** @brief BaseGyroscope Virtual Methods Table. */
const struct BaseGyroscopeVMT *vmt_basegyroscope;
/** @brief L3GD20 Virtual Methods Table. */
const struct L3GD20VMT *vmt_l3gd20;
const struct BaseSensorVMT *vmt_sensor;
_base_sensor_data
/** @brief L3GD20 Gyroscope Virtual Methods Table. */
const struct L3GD20GyroscopeVMT *vmt_gyroscope;
_base_gyroscope_data
_l3gd20_data
};
/**
* @brief Structure representing a L3GD20 driver.
*/
typedef struct L3GD20Driver L3GD20Driver;
/** @} */
/*===========================================================================*/
@ -545,7 +551,7 @@ struct L3GD20Driver {
* @api
*/
#define gyroscopeSetFullScale(ip, fs) \
(ip)->vmt_l3gd20->set_full_scale(ip, fs)
(ip)->vmt_gyroscope->set_full_scale(ip, fs)
/*===========================================================================*/
/* External declarations. */