MTDOT-BOX-EVB-Factory-Firmware
Dependencies: NCP5623B GpsParser ISL29011 libmDot-mbed5 MTS-Serial MMA845x DOGS102 MPL3115A2
Diff: SensorHandler/SensorHandler.cpp
- Revision:
- 12:05435282f899
- Parent:
- 1:71125aa00e33
--- a/SensorHandler/SensorHandler.cpp Thu Nov 10 22:10:58 2016 +0000 +++ b/SensorHandler/SensorHandler.cpp Tue Oct 09 13:49:30 2018 -0500 @@ -26,12 +26,11 @@ #include "SensorHandler.h" -SensorHandler::SensorHandler() - : _getSensorThread(&SensorHandler::startSensorThread, this), - _mDoti2c(PC_9,PA_8), - _accelerometer(_mDoti2c,MMA845x::SA0_VSS), - _barometricSensor(_mDoti2c), - _lightSensor(_mDoti2c) +SensorHandler::SensorHandler(I2C& i2c) + : _getSensorThread(&SensorHandler::startSensorThread, this) + , _accelerometer(i2c, MMA845x::SA0_VSS) + , _barometricSensor(i2c) + , _lightSensor(i2c) { SensorHandler::initSensors(); _getSensorThread.signal_set(START_THREAD); @@ -63,7 +62,7 @@ _accelerometer.activeMode(); // Clear the min-max registers in the Barometric Sensor - _barometricSensor.clearMinMaxRegs(); + _barometricSensor.clearMinMaxRegs(); } void SensorHandler::startSensorThread(void const *p) @@ -130,7 +129,7 @@ _mutex.unlock(); } } while (((result & MPL3115A2::PTDR) == 0 ) && (timer.read_ms() < 100)); - + // Retrieve light level _mutex.lock(); _light = _lightSensor.getData();