aboutsummaryrefslogtreecommitdiffstats
path: root/os/ex
diff options
context:
space:
mode:
authorRocco Marco Guglielmi <roccomarco.guglielmi@live.com>2016-07-10 20:01:00 +0000
committerRocco Marco Guglielmi <roccomarco.guglielmi@live.com>2016-07-10 20:01:00 +0000
commitd5917172bca6d7add8c7f7b17c77900c8b0fdac0 (patch)
tree02cb83b19d571082799be559abb12acdd82399c7 /os/ex
parent724eef04f372d36f8c3893bbd4111a912a954d02 (diff)
downloadChibiOS-d5917172bca6d7add8c7f7b17c77900c8b0fdac0.tar.gz
ChibiOS-d5917172bca6d7add8c7f7b17c77900c8b0fdac0.tar.bz2
ChibiOS-d5917172bca6d7add8c7f7b17c77900c8b0fdac0.zip
Removed measurement unit management from L3GD20 driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9699 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/ex')
-rw-r--r--os/ex/ST/l3gd20.c63
-rw-r--r--os/ex/ST/l3gd20.h34
2 files changed, 11 insertions, 86 deletions
diff --git a/os/ex/ST/l3gd20.c b/os/ex/ST/l3gd20.c
index faec7c13b..d214b9e9d 100644
--- a/os/ex/ST/l3gd20.c
+++ b/os/ex/ST/l3gd20.c
@@ -264,24 +264,6 @@ static msg_t set_full_scale(void *ip, l3gd20_fs_t fs) {
return MSG_OK;
}
-static msg_t set_meas_unit(void *ip, l3gd20_unit_t unit) {
- unsigned i;
- if(unit != ((L3GD20Driver *)ip)->meas_unit) {
- ((L3GD20Driver *)ip)->meas_unit = unit;
- /* From RPS to DPS */
- if(unit == L3GD20_UNIT_DPS)
- for(i = 0; i < L3GD20_NUMBER_OF_AXES; i++)
- ((L3GD20Driver *)ip)->sensitivity[i] *= (2 * PI);
- /* From DPS to RPS */
- else if(unit == L3GD20_UNIT_RPS)
- for(i = 0; i < L3GD20_NUMBER_OF_AXES; i++)
- ((L3GD20Driver *)ip)->sensitivity[i] /= (2 * PI);
- else
- return MSG_RESET;
- }
- return MSG_OK;
-}
-
static const struct BaseSensorVMT vmt_basesensor = {
get_axes_number, read_raw, read_cooked
};
@@ -296,7 +278,7 @@ static const struct L3GD20VMT vmt_l3gd20 = {
get_axes_number, read_raw, read_cooked,
sample_bias, set_bias, reset_bias,
set_sensivity, reset_sensivity,
- set_full_scale, set_meas_unit
+ set_full_scale
};
/*===========================================================================*/
@@ -395,50 +377,23 @@ void l3gd20Start(L3GD20Driver *devp, const L3GD20Config *config) {
#if L3GD20_SHARED_SPI
spiReleaseBus((devp)->config->spip);
#endif /* L3GD20_SHARED_SPI */
-#endif /* L3GD20_USE_SPI */
+#endif /* L3GD20_USE_SPI */
- /* Storing sensitivity information according to full scale and unit value.*/
+ /* Storing sensitivity information according to full scale.*/
if(devp->config->fullscale == L3GD20_FS_250DPS) {
devp->fullscale = L3GD20_250DPS;
- for(i = 0; i < L3GD20_NUMBER_OF_AXES; i++) {
- if(devp->meas_unit == L3GD20_UNIT_DPS) {
- devp->sensitivity[i] = L3GD20_SENS_250DPS;
- }
- else if (devp->meas_unit == L3GD20_UNIT_RPS) {
- devp->sensitivity[i] = L3GD20_SENS_250DPS / (2 * PI);
- }
- else {
- devp->sensitivity[i] = 1.0;
- }
- }
+ for(i = 0; i < L3GD20_NUMBER_OF_AXES; i++)
+ devp->sensitivity[i] = L3GD20_SENS_250DPS;
}
else if(devp->config->fullscale == L3GD20_FS_500DPS) {
devp->fullscale = L3GD20_500DPS;
- for(i = 0; i < L3GD20_NUMBER_OF_AXES; i++) {
- if(devp->meas_unit == L3GD20_UNIT_DPS) {
- devp->sensitivity[i] = L3GD20_SENS_500DPS;
- }
- else if (devp->meas_unit == L3GD20_UNIT_RPS) {
- devp->sensitivity[i] = L3GD20_SENS_500DPS / (2 * PI);
- }
- else {
- devp->sensitivity[i] = 1.0;
- }
- }
+ for(i = 0; i < L3GD20_NUMBER_OF_AXES; i++)
+ devp->sensitivity[i] = L3GD20_SENS_500DPS;
}
else if(devp->config->fullscale == L3GD20_FS_2000DPS) {
devp->fullscale = L3GD20_2000DPS;
- for(i = 0; i < L3GD20_NUMBER_OF_AXES; i++) {
- if(devp->meas_unit == L3GD20_UNIT_DPS) {
- devp->sensitivity[i] = L3GD20_SENS_500DPS;
- }
- else if (devp->meas_unit == L3GD20_UNIT_RPS) {
- devp->sensitivity[i] = L3GD20_SENS_500DPS / (2 * PI);
- }
- else {
- devp->sensitivity[i] = 1.0;
- }
- }
+ for(i = 0; i < L3GD20_NUMBER_OF_AXES; i++)
+ devp->sensitivity[i] = L3GD20_SENS_2000DPS;
}
else
osalDbgAssert(FALSE, "l3gd20Start(), full scale issue");
diff --git a/os/ex/ST/l3gd20.h b/os/ex/ST/l3gd20.h
index f2c3907da..f6b1780a7 100644
--- a/os/ex/ST/l3gd20.h
+++ b/os/ex/ST/l3gd20.h
@@ -393,14 +393,6 @@ typedef enum {
}l3gd20_end_t;
/**
- * @brief L3GD20 measurement unit.
- */
-typedef enum {
- L3GD20_UNIT_DPS = 0x00, /**< Cooked data in degrees per seconds.*/
- L3GD20_UNIT_RPS = 0x01, /**< Cooked data in radians per seconds.*/
-} l3gd20_unit_t;
-
-/**
* @brief Driver state machine possible states.
*/
typedef enum {
@@ -442,10 +434,6 @@ typedef struct {
* @brief L3GD20 initial bias.
*/
float bias[L3GD20_NUMBER_OF_AXES];
- /**
- * @brief L3GD20 initial measurement unit.
- */
- l3gd20_unit_t unit;
/**
* @brief L3GD20 initial full scale value.
*/
@@ -494,9 +482,7 @@ typedef struct L3GD20Driver L3GD20Driver;
#define _l3gd20_methods \
_base_gyroscope_methods \
/* Change full scale value of L3GD20 .*/ \
- msg_t (*set_full_scale)(void *instance, l3gd20_fs_t fs); \
- /* Change measurement unit of L3GD20 .*/ \
- msg_t (*set_meas_unit)(void *instance, l3gd20_unit_t unit); \
+ msg_t (*set_full_scale)(void *instance, l3gd20_fs_t fs);
/**
* @extends BaseGyroscopeVMT
@@ -521,9 +507,7 @@ struct L3GD20VMT {
/* Current Bias data.*/ \
float bias[L3GD20_NUMBER_OF_AXES]; \
/* Current full scale value.*/ \
- float fullscale; \
- /* Measurement unit.*/ \
- l3gd20_unit_t meas_unit;
+ float fullscale;
/**
* @extends BaseGyroscope
@@ -560,20 +544,6 @@ struct L3GD20Driver {
*/
#define gyroscopeSetFullScale(ip, fs) \
(ip)->vmt_l3gd20->set_full_scale(ip, fs)
-
-/**
- * @brief Set gyroscope cooked data measurement unit.
- *
- * @param[in] ip pointer to a @p BaseGyroscope class.
- * @param[in] unit the MEMS measurement unit.
- *
- * @return The operation status.
- * @retval MSG_OK if the function succeeded.
- * @retval MSG_RESET if one or more errors occurred.
- * @api
- */
-#define gyroscopeSetMeasurementUnit(ip, unit) \
- (ip)->vmt_l3gd20->set_meas_unit(ip, unit)
/*===========================================================================*/
/* External declarations. */