Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: CalibrateMagneto QuaternionMath
Fork of SML2 by
Diff: LEDDriver.cpp
- Revision:
- 33:bd56fc8aeb0a
- Parent:
- 25:abb0f208e6a9
- Child:
- 35:fb6e4601adf3
--- a/LEDDriver.cpp Mon May 04 15:16:57 2015 +0000
+++ b/LEDDriver.cpp Tue May 05 09:59:11 2015 +0000
@@ -21,6 +21,7 @@
void LEDDriver::setColor(const uint8_t r, const uint8_t g, const uint8_t b)
{
+ write_reg(0x0e, b);
write_reg(0x04, g);
write_reg(0x03, r);
write_reg(0x02, b);
@@ -39,6 +40,12 @@
setColor(r, g, b);
}
+void LEDDriver::setWhiteLed(const float w)
+{
+ const uint8_t value = (uint8_t) (w * 255);
+ write_reg(0x0e, value);
+}
+
LEDDriver& LEDDriver::operator=(const Color& c)
{
setColor(c);
@@ -54,5 +61,6 @@
write_reg(0x05, mA * 10);
write_reg(0x06, mA * 10);
write_reg(0x07, mA * 10);
+ write_reg(0x0f, mA * 10);
INFO("Output current => %0.1f mA", mA);
}
