Modified for compatibility with Rev.E. hardware

Fork of AkmSensor by AKM Development Platform

Revision:
29:b488d2c89fba
Parent:
27:41aa9fb23a2f
Child:
37:c76d2edf3426
diff -r dc4eb14e4d7e -r b488d2c89fba akmanalogsensor.cpp
--- a/akmanalogsensor.cpp	Sat Mar 11 02:08:32 2017 +0000
+++ b/akmanalogsensor.cpp	Fri Mar 17 23:29:20 2017 +0000
@@ -76,18 +76,15 @@
     return AkmSensor::SUCCESS;
 }
 
-void AkmAnalogSensor::eventCallback(){
-    event = true;
-}
-
 AkmSensor::Status AkmAnalogSensor::startSensor(){
-    ticker.attach(callback(this, &AkmAnalogSensor::eventCallback), interval);
+    ticker.attach(callback(this, &AkmSensor::setEvent), interval);
     return AkmSensor::SUCCESS;
 }
 
 AkmSensor::Status AkmAnalogSensor::startSensor(const float sec){
     interval = sec;
-    ticker.attach(callback(this, &AkmAnalogSensor::eventCallback), interval);
+    ticker.attach(callback(this, &AkmSensor::setEvent), interval);
+    MSG("#Start sensor %s.\r\n",sensorName);
     return AkmSensor::SUCCESS;
 }
 
@@ -97,16 +94,10 @@
 }
 
 AkmSensor::Status AkmAnalogSensor::readSensorData(Message* msg){
-    event = false;
+    AkmSensor::clearEvent();
     
     msg->setCommand(Message::CMD_START_MEASUREMENT);
 
-//    if(primaryId == AKM_PRIMARY_ID_LINEAR_SENSOR_LEGACY){
-//        uint16_t value;
-//        float s = *ain;
-//        value = s*1024;
-//        msg->setArgument( 0, (char)( value >> 8) );
-//        msg->setArgument( 1, (char)( value & 0x00FF) );
     if(primaryId == AKM_PRIMARY_ID_LINEAR_SENSOR || 
             primaryId == AKM_PRIMARY_ID_MISC_ANALOG || 
             primaryId == AKM_PRIMARY_ID_CURRENT_SENSOR){