Modified for compatibility with Rev.E. hardware
Fork of AkmSensor by
Diff: ak7451ctrl.cpp
- Revision:
- 29:b488d2c89fba
- Parent:
- 27:41aa9fb23a2f
- Child:
- 30:5a241d9b3262
--- a/ak7451ctrl.cpp Sat Mar 11 02:08:32 2017 +0000 +++ b/ak7451ctrl.cpp Fri Mar 17 23:29:20 2017 +0000 @@ -64,29 +64,27 @@ return AkmSensor::SUCCESS; } -void Ak7451Ctrl::eventCallback(){ - event = true; -} - AkmSensor::Status Ak7451Ctrl::startSensor(){ - ticker.attach(callback(this, &Ak7451Ctrl::eventCallback), interval); + ticker.attach(callback(this, &AkmSensor::setEvent), interval); return AkmSensor::SUCCESS; } AkmSensor::Status Ak7451Ctrl::startSensor(const float sec){ interval = sec; - ticker.attach(callback(this, &Ak7451Ctrl::eventCallback), interval); + ticker.attach(callback(this, &AkmSensor::setEvent), interval); + MSG("#Start sensor %s.\r\n",sensorName); return AkmSensor::SUCCESS; } AkmSensor::Status Ak7451Ctrl::stopSensor(){ ticker.detach(); - event = false; + AkmSensor::clearEvent(); return AkmSensor::SUCCESS; } AkmSensor::Status Ak7451Ctrl::readSensorData(Message* msg){ - event = false; + AkmSensor::clearEvent(); + char angle[2] = {0x00,0x00}; AK7451::Status status = ak7451->readAngle(angle);