@@ -992,10 +992,10 @@ enum SensorAccelRange
992992 SENSOR_ACCEL_RANGE_8G,
993993 SENSOR_ACCEL_RANGE_16G,
994994};
995- #define SENSOR_ACCEL_SENSITIVITY_2G (0 . 001F )
996- #define SENSOR_ACCEL_SENSITIVITY_4G (0 . 002F )
997- #define SENSOR_ACCEL_SENSITIVITY_8G (0 . 004F )
998- #define SENSOR_ACCEL_SENSITIVITY_16G (0 . 012F )
995+ #define SENSOR_ACCEL_SENSITIVITY_2G (( float ) 2 / 32768 )
996+ #define SENSOR_ACCEL_SENSITIVITY_4G (( float ) 4 / 32768 )
997+ #define SENSOR_ACCEL_SENSITIVITY_8G (( float ) 8 / 32768 )
998+ #define SENSOR_ACCEL_SENSITIVITY_16G (( float ) 16 / 32768 )
999999
10001000enum SensorGyroRange
10011001{
@@ -1040,12 +1040,13 @@ typedef struct SensorConfig
10401040
10411041 union range
10421042 {
1043+ int range;
10431044 enum SensorAccelRange accel_range;
10441045 enum SensorGyroRange gyro_range;
10451046 } range;
10461047}SensorConfig;
10471048
1048- typedef void (*SensorEventHandler_t)(sensors_event_t *event, void *user_data);
1049+ typedef void (*SensorEventHandler_t)(void *user_data);
10491050
10501051#ifdef __cplusplus
10511052class SensorBase ;
@@ -1074,8 +1075,8 @@ class SensorBase
10741075 int setConfig (SensorConfig *config);
10751076 int getConfig (SensorConfig *config);
10761077
1077- int subscribe (SensorEventHandler_t * handler, void *user_data);
1078- int publish (sensors_event_t *event );
1078+ int subscribe (SensorEventHandler_t handler, void *user_data);
1079+ int publish (void );
10791080
10801081protected:
10811082 SensorBase *next;
@@ -1084,7 +1085,7 @@ class SensorBase
10841085 /* sensor configuration */
10851086 SensorConfig config;
10861087
1087- SensorEventHandler_t * evtHandler;
1088+ SensorEventHandler_t evtHandler;
10881089 void *userData;
10891090
10901091 friend class SensorManager ;
@@ -1103,7 +1104,7 @@ class SensorManager
11031104 static int unregisterSensor (SensorBase *sensor);
11041105
11051106 static SensorBase *getDefaultSensor (int type);
1106- static int subscribe (int type, SensorEventHandler_t * handler, void *user_data);
1107+ static int subscribe (int type, SensorEventHandler_t handler, void *user_data);
11071108
11081109 static int sensorEventReady (SensorBase *sensor);
11091110 static int pollSensor (SensorBase *sensor, sensors_event_t *events, int number, int duration);
@@ -1120,7 +1121,7 @@ extern "C" {
11201121
11211122rt_sensor_t rt_sensor_get_default (int type);
11221123
1123- int rt_sensor_subscribe (rt_sensor_t sensor, SensorEventHandler_t * handler, void *user_data);
1124+ int rt_sensor_subscribe (rt_sensor_t sensor, SensorEventHandler_t handler, void *user_data);
11241125int rt_sensor_activate (rt_sensor_t sensor, int enable);
11251126int rt_sensor_configure (rt_sensor_t sensor, SensorConfig *config);
11261127int rt_sensor_poll (rt_sensor_t sensor, sensors_event_t *event);
0 commit comments