diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-02-26 16:28:43 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-02-26 16:28:43 +0000 |
commit | 70fb3b40569070168d85a65ede1ca8112a9394f8 (patch) | |
tree | 647ee84eb90b6d984e850e4772b4ea3dbe3bc1f1 /os | |
parent | e8dda5f8eea2d59fa92e124327e4b2f7885d75ad (diff) | |
download | ChibiOS-70fb3b40569070168d85a65ede1ca8112a9394f8.tar.gz ChibiOS-70fb3b40569070168d85a65ede1ca8112a9394f8.tar.bz2 ChibiOS-70fb3b40569070168d85a65ede1ca8112a9394f8.zip |
Modified sensor classes, not complete yet.
git-svn-id: https://svn.code.sf.net/p/chibios/svn2/trunk@11550 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os')
-rw-r--r-- | os/ex/ST/lsm303dlhc.c | 3 | ||||
-rw-r--r-- | os/ex/ST/lsm303dlhc.h | 62 | ||||
-rw-r--r-- | os/hal/lib/peripherals/sensors/hal_accelerometer.h | 2 | ||||
-rw-r--r-- | os/hal/lib/peripherals/sensors/hal_barometer.h | 2 | ||||
-rw-r--r-- | os/hal/lib/peripherals/sensors/hal_compass.h | 2 | ||||
-rw-r--r-- | os/hal/lib/peripherals/sensors/hal_gyroscope.h | 2 | ||||
-rw-r--r-- | os/hal/lib/peripherals/sensors/hal_hygrometer.h | 2 | ||||
-rw-r--r-- | os/hal/lib/peripherals/sensors/hal_sensors.h | 4 | ||||
-rw-r--r-- | os/hal/lib/peripherals/sensors/hal_thermometer.h | 2 |
9 files changed, 38 insertions, 43 deletions
diff --git a/os/ex/ST/lsm303dlhc.c b/os/ex/ST/lsm303dlhc.c index 111cdb7e5..6ec94796c 100644 --- a/os/ex/ST/lsm303dlhc.c +++ b/os/ex/ST/lsm303dlhc.c @@ -605,16 +605,19 @@ static msg_t comp_set_full_scale(void *ip, lsm303dlhc_comp_fs_t fs) { }
static const struct BaseSensorVMT vmt_sensor = {
+ (size_t)0,
sens_get_axes_number, sens_read_raw, sens_read_cooked
};
static const struct LSM303DLHCAcceleromerVMT vmt_accelerometer = {
+ (size_t)0,
acc_get_axes_number, acc_read_raw, acc_read_cooked,
acc_set_bias, acc_reset_bias, acc_set_sensivity, acc_reset_sensivity,
acc_set_full_scale
};
static const struct LSM303DLHCCompassVMT vmt_compass = {
+ (size_t)0,
comp_get_axes_number, comp_read_raw, comp_read_cooked,
comp_set_bias, comp_reset_bias, comp_set_sensivity, comp_reset_sensivity,
comp_set_full_scale
diff --git a/os/ex/ST/lsm303dlhc.h b/os/ex/ST/lsm303dlhc.h index 168746398..991c0eb3d 100644 --- a/os/ex/ST/lsm303dlhc.h +++ b/os/ex/ST/lsm303dlhc.h @@ -571,56 +571,35 @@ typedef struct { } LSM303DLHCConfig;
/**
- * @brief @p LSM303DLHC accelerometer subsystem specific methods.
+ * @brief @p LSM303DLHC subsystem specific methods.
*/
-#define _lsm303dlhc_accelerometer_methods_alone \
+#define _lsm303dlhc_methods_alone \
/* Change full scale value of LSM303DLHC accelerometer subsystem .*/ \
- msg_t (*set_full_scale)(void *instance, lsm303dlhc_acc_fs_t fs);
-
-/**
- * @brief @p LSM303DLHC accelerometer subsystem specific methods with
- * inherited ones.
- */
-#define _lsm303dlhc_accelerometer_methods \
- _base_accelerometer_methods \
- _lsm303dlhc_accelerometer_methods_alone
-
-/**
- * @brief @p LSM303DLHC compass subsystem specific methods.
- */
-#define _lsm303dlhc_compass_methods_alone \
+ msg_t (*set_acc_full_scale)(void *instance, lsm303dlhc_acc_fs_t fs);
/* Change full scale value of LSM303DLHC compass subsystem .*/ \
- msg_t (*set_full_scale)(void *instance, lsm303dlhc_comp_fs_t fs);
-
-/**
- * @brief @p LSM303DLHC compass subsystem specific methods with inherited ones.
- */
-#define _lsm303dlhc_compass_methods \
- _base_compass_methods \
- _lsm303dlhc_compass_methods_alone
+ msg_t (*set_comp_full_scale)(void *instance, lsm303dlhc_comp_fs_t fs);
/**
- * @extends BaseAccelerometerVMT
- *
- * @brief @p LSM303DLHC accelerometer virtual methods table.
+ * @brief @p LSM303DLHC subsystem specific methods with inherited ones.
*/
-struct LSM303DLHCAcceleromerVMT {
- _lsm303dlhc_accelerometer_methods
-};
+#define _lsm303dlhc_methods \
+ _base_object_methods \
+ _lsm303dlhc_methods_alone
/**
- * @extends BaseCompassVMT
+ * @extends BaseObjectVMT
*
- * @brief @p LSM303DLHC compass virtual methods table.
+ * @brief @p LSM303DLHC virtual methods table.
*/
-struct LSM303DLHCCompassVMT {
- _lsm303dlhc_compass_methods
+struct LSM303DLHCVMT {
+ _lsm303dlhc_methods
};
/**
* @brief @p LSM303DLHCDriver specific data.
*/
#define _lsm303dlhc_data \
+ _base_sensor_data \
/* Driver state.*/ \
lsm303dlhc_state_t state; \
/* Current configuration data.*/ \
@@ -642,15 +621,12 @@ struct LSM303DLHCCompassVMT { * @brief LSM303DLHC 6-axis accelerometer/compass class.
*/
struct LSM303DLHCDriver {
- /** @brief BaseSensor Virtual Methods Table. */
- const struct BaseSensorVMT *vmt_sensor;
- _base_sensor_data
- /** @brief LSM303DLHC Accelerometer Virtual Methods Table. */
- const struct LSM303DLHCAcceleromerVMT *vmt_accelerometer;
- _base_accelerometer_data
- /** @brief LSM303DLHC Compass Virtual Methods Table. */
- const struct LSM303DLHCCompassVMT *vmt_compass;
- _base_compass_data
+ /** @brief Virtual Methods Table.*/
+ const struct LSM303DLHCVMT *vmt;
+ /** @brief Accelerometer interface.*/
+ BaseAccelerometer accelerometer_if;
+ /** @brief Compass interface.*/
+ BaseCompass compass_if;
_lsm303dlhc_data
};
diff --git a/os/hal/lib/peripherals/sensors/hal_accelerometer.h b/os/hal/lib/peripherals/sensors/hal_accelerometer.h index 91bc6fd0a..43395fe63 100644 --- a/os/hal/lib/peripherals/sensors/hal_accelerometer.h +++ b/os/hal/lib/peripherals/sensors/hal_accelerometer.h @@ -77,6 +77,8 @@ struct BaseAccelerometerVMT { _base_sensor_data
/**
+ * @extends BaseSensor
+ *
* @brief Base accelerometer class.
* @details This class represents a generic a generic accelerometer.
*/
diff --git a/os/hal/lib/peripherals/sensors/hal_barometer.h b/os/hal/lib/peripherals/sensors/hal_barometer.h index 1ab4552cb..275fefa10 100644 --- a/os/hal/lib/peripherals/sensors/hal_barometer.h +++ b/os/hal/lib/peripherals/sensors/hal_barometer.h @@ -78,6 +78,8 @@ struct BaseBarometerVMT { _base_sensor_data
/**
+ * @extends BaseSensor
+ *
* @brief Base barometer class.
* @details This class represents a generic barometer.
*/
diff --git a/os/hal/lib/peripherals/sensors/hal_compass.h b/os/hal/lib/peripherals/sensors/hal_compass.h index 83ab8b2ab..e777070c3 100644 --- a/os/hal/lib/peripherals/sensors/hal_compass.h +++ b/os/hal/lib/peripherals/sensors/hal_compass.h @@ -78,6 +78,8 @@ struct BaseCompassVMT { _base_sensor_data
/**
+ * @extends BaseSensor
+ *
* @brief Base compass class.
* @details This class represents a generic compass.
*/
diff --git a/os/hal/lib/peripherals/sensors/hal_gyroscope.h b/os/hal/lib/peripherals/sensors/hal_gyroscope.h index 47b3708c8..f5bfc1f03 100644 --- a/os/hal/lib/peripherals/sensors/hal_gyroscope.h +++ b/os/hal/lib/peripherals/sensors/hal_gyroscope.h @@ -80,6 +80,8 @@ struct BaseGyroscopeVMT { _base_sensor_data
/**
+ * @extends BaseSensor
+ *
* @brief Base gyroscope class.
* @details This class represents a generic gyroscope.
*/
diff --git a/os/hal/lib/peripherals/sensors/hal_hygrometer.h b/os/hal/lib/peripherals/sensors/hal_hygrometer.h index 3feace0bc..31c066e92 100644 --- a/os/hal/lib/peripherals/sensors/hal_hygrometer.h +++ b/os/hal/lib/peripherals/sensors/hal_hygrometer.h @@ -78,6 +78,8 @@ struct BaseHygrometerVMT { _base_sensor_data
/**
+ * @extends BaseSensor
+ *
* @brief Base hygrometer class.
* @details This class represents a generic hygrometer.
*/
diff --git a/os/hal/lib/peripherals/sensors/hal_sensors.h b/os/hal/lib/peripherals/sensors/hal_sensors.h index 0a09a3b21..b5c6b4e9d 100644 --- a/os/hal/lib/peripherals/sensors/hal_sensors.h +++ b/os/hal/lib/peripherals/sensors/hal_sensors.h @@ -56,6 +56,7 @@ * @brief BaseSensor specific methods with inherited ones.
*/
#define _base_sensor_methods \
+ _base_object_methods \
_base_sensor_methods_alone
/**
@@ -71,8 +72,11 @@ struct BaseSensorVMT { * without implementation.
*/
#define _base_sensor_data
+ _base_object_data \
/**
+ * @extends BaseObject
+ *
* @brief Base stream class.
* @details This class represents a generic blocking unbuffered sequential
* data stream.
diff --git a/os/hal/lib/peripherals/sensors/hal_thermometer.h b/os/hal/lib/peripherals/sensors/hal_thermometer.h index 2094d9c0a..6cf13d7f2 100644 --- a/os/hal/lib/peripherals/sensors/hal_thermometer.h +++ b/os/hal/lib/peripherals/sensors/hal_thermometer.h @@ -78,6 +78,8 @@ struct BaseThermometerVMT { _base_sensor_data
/**
+ * @extends BaseSensor
+ *
* @brief Base thermometer class.
* @details This class represents a generic thermometer.
*/
|