Implemented first Hangar-Service
Dependencies: CalibrateMagneto QuaternionMath
Fork of SML2 by
Diff: LEDDriver.cpp
- Revision:
- 18:f51b1a94a6e2
- Parent:
- 12:1632d7391453
- Child:
- 25:abb0f208e6a9
--- a/LEDDriver.cpp Thu Mar 26 15:43:49 2015 +0000 +++ b/LEDDriver.cpp Tue Mar 31 15:21:34 2015 +0000 @@ -2,7 +2,6 @@ #include "mbed.h" #define DEBUG "LEDDriver" #include "Logger.h" -#include <cassert> LEDDriver::LEDDriver(I2C &i2c) : I2CPeripheral(i2c, 0x60 /* I2C address of the LED controller */) { @@ -46,10 +45,12 @@ return *this; } -void LEDDriver::setOutputCurrent(const float mA) +void LEDDriver::setOutputCurrent(float mA) { - assert(mA <= 25.5); - assert(mA >= 0.1); + if (mA < 0.1) + mA = 0.1; + if (mA > 25.5) + mA = 25.5; write_reg(0x05, mA * 10); write_reg(0x06, mA * 10); write_reg(0x07, mA * 10);