From 8b95f8629b2884fffc64dc3a64c6a372d566551e Mon Sep 17 00:00:00 2001 From: Rocco Marco Guglielmi Date: Fri, 11 Mar 2016 15:53:20 +0000 Subject: Updated peripheral interfaces git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9077 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/lib/peripherals/include/hal_accelerometer.h | 8 ++--- os/hal/lib/peripherals/include/hal_compass.h | 34 +++------------------- os/hal/lib/peripherals/include/hal_gyroscope.h | 12 ++++---- os/hal/lib/peripherals/include/hal_sensors.h | 8 ++--- 4 files changed, 18 insertions(+), 44 deletions(-) diff --git a/os/hal/lib/peripherals/include/hal_accelerometer.h b/os/hal/lib/peripherals/include/hal_accelerometer.h index c557dc96f..37927f37e 100644 --- a/os/hal/lib/peripherals/include/hal_accelerometer.h +++ b/os/hal/lib/peripherals/include/hal_accelerometer.h @@ -74,7 +74,7 @@ struct BaseAccelerometerVMT { */ typedef struct { /** @brief Virtual Methods Table.*/ - const struct BaseAccelerometerVMT *vmt; + const struct BaseAccelerometerVMT *vmtac; _base_sensor_data } BaseAccelerometer; @@ -94,7 +94,7 @@ typedef struct { * * @api */ -#define accelerometerGetAxesNumber(ip) sensorGetAxesNumber(ip) +#define accelerometerGetAxesNumber(ip) ((ip)->vmtac->get_axes_number(ip)) /** * @brief Accelerometer read raw data. @@ -108,7 +108,7 @@ typedef struct { * * @api */ -#define accelerometerReadRaw(ip, dp) sensorReadRaw(ip, dp) +#define accelerometerReadRaw(ip, dp) ((ip)->vmtac->read_raw(ip, dp)) /** * @brief Accelerometer read cooked data. @@ -122,7 +122,7 @@ typedef struct { * * @api */ -#define accelerometerReadCooked(ip, dp) sensorReadCooked(ip, dp) +#define accelerometerReadCooked(ip, dp) ((ip)->vmtac->read_cooked(ip, dp)) /** @} */ /*===========================================================================*/ diff --git a/os/hal/lib/peripherals/include/hal_compass.h b/os/hal/lib/peripherals/include/hal_compass.h index 9d4678878..67e1ca9a9 100644 --- a/os/hal/lib/peripherals/include/hal_compass.h +++ b/os/hal/lib/peripherals/include/hal_compass.h @@ -74,7 +74,7 @@ struct BaseCompassVMT { */ typedef struct { /** @brief Virtual Methods Table.*/ - const struct BaseCompassVMT *vmt; + const struct BaseCompassVMT *vmtco; _base_compass_data } BaseCompass; @@ -93,7 +93,7 @@ typedef struct { * * @api */ -#define compassGetAxesNumber(ip) sensorGetAxesNumber(ip) +#define compassGetAxesNumber(ip) ((ip)->vmtco->get_axes_number(ip)) /** * @brief Compass read raw data. @@ -107,7 +107,7 @@ typedef struct { * * @api */ -#define compassReadRaw(ip, dp) sensorReadRaw(ip, dp) +#define compassReadRaw(ip, dp) ((ip)->vmtco->read_raw(ip, dp)) /** * @brief Compass read cooked data. @@ -121,33 +121,7 @@ typedef struct { * * @api */ -#define compassReadCooked(ip, dp) sensorReadCooked(ip, dp) - -/** - * @brief Delete calibration data. - * - * @param[in] ip pointer to a @p BaseCompass class. - * - * @return The operation status. - * @retval MSG_OK if the function succeeded. - * @retval MSG_RESET if one or more errors occurred. - * - * @api - */ -#define compassResetCalibration(ip) ((ip)->vmt->reset_calibration(ip)) - -/** - * @brief Compass calibration procedure. - * - * @param[in] ip pointer to a @p BaseCompass class. - * - * @return The operation status. - * @retval MSG_OK if the function succeeded. - * @retval MSG_RESET if one or more errors occurred. - * - * @api - */ -#define compassCalibrate(ip) ((ip)->vmt->calibrate(ip)) +#define compassReadCooked(ip, dp) ((ip)->vmtco->read_cooked(ip, dp)) /** @} */ /*===========================================================================*/ diff --git a/os/hal/lib/peripherals/include/hal_gyroscope.h b/os/hal/lib/peripherals/include/hal_gyroscope.h index 4d551d777..f2b162f15 100644 --- a/os/hal/lib/peripherals/include/hal_gyroscope.h +++ b/os/hal/lib/peripherals/include/hal_gyroscope.h @@ -78,7 +78,7 @@ struct BaseGyroscopeVMT { */ typedef struct { /** @brief Virtual Methods Table.*/ - const struct BaseGyroscopeVMT *vmt; + const struct BaseGyroscopeVMT *vmtgy; _base_gyroscope_data } BaseGyroscope; @@ -98,7 +98,7 @@ typedef struct { * * @api */ -#define gyroscopeGetAxesNumber(ip) sensorGetAxesNumber(ip) +#define gyroscopeGetAxesNumber(ip) ((ip)->vmtgy->get_axes_number(ip)) /** * @brief Gyroscope read raw data. @@ -112,7 +112,7 @@ typedef struct { * * @api */ -#define gyroscopeReadRaw(ip, dp) sensorReadRaw(ip, dp) +#define gyroscopeReadRaw(ip, dp) ((ip)->vmtgy->read_raw(ip, dp)) /** * @brief Gyroscope read cooked data. @@ -126,7 +126,7 @@ typedef struct { * * @api */ -#define gyroscopeReadCooked(ip, dp) sensorReadCooked(ip, dp) +#define gyroscopeReadCooked(ip, dp) ((ip)->vmtgy->read_cooked(ip, dp)) /** * @brief Delete calibration data. @@ -139,7 +139,7 @@ typedef struct { * * @api */ -#define gyroscopeResetCalibration(ip) ((ip)->vmt->reset_calibration(ip)) +#define gyroscopeResetCalibration(ip) ((ip)->vmtgy->reset_calibration(ip)) /** * @brief Gyroscope calibration procedure. @@ -152,7 +152,7 @@ typedef struct { * * @api */ -#define gyroscopeCalibrate(ip) ((ip)->vmt->calibrate(ip)) +#define gyroscopeCalibrate(ip) ((ip)->vmtgy->calibrate(ip)) /** @} */ /*===========================================================================*/ diff --git a/os/hal/lib/peripherals/include/hal_sensors.h b/os/hal/lib/peripherals/include/hal_sensors.h index b722161b6..ee65e98b2 100644 --- a/os/hal/lib/peripherals/include/hal_sensors.h +++ b/os/hal/lib/peripherals/include/hal_sensors.h @@ -79,7 +79,7 @@ struct BaseSensorVMT { */ typedef struct { /** @brief Virtual Methods Table.*/ - const struct BaseSensorVMT *vmt; + const struct BaseSensorVMT *vmtse; _base_sensor_data } BaseSensor; @@ -99,7 +99,7 @@ typedef struct { * * @api */ -#define sensorGetAxesNumber(ip) ((ip)->vmt->get_axes_number(ip)) +#define sensorGetAxesNumber(ip) ((ip)->vmtse->get_axes_number(ip)) /** * @brief Sensors read raw data. @@ -113,7 +113,7 @@ typedef struct { * * @api */ -#define sensorReadRaw(ip, dp) ((ip)->vmt->read_raw(ip, dp)) +#define sensorReadRaw(ip, dp) ((ip)->vmtse->read_raw(ip, dp)) /** * @brief Sensors read cooked data. @@ -127,7 +127,7 @@ typedef struct { * * @api */ -#define sensorReadCooked(ip, dp) ((ip)->vmt->read_cooked(ip, dp)) +#define sensorReadCooked(ip, dp) ((ip)->vmtse->read_cooked(ip, dp)) /** @} */ /*===========================================================================*/ -- cgit v1.2.3