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.
Dependents: ColorDetector ColorDetectorV2 offline_sync_k64f
Fork of GroveColourSensor by
Diff: GroveColourSensor.cpp
- Revision:
- 4:f0e8304db2a3
- Parent:
- 3:a401a082d57e
- Child:
- 5:f6a136b99533
--- a/GroveColourSensor.cpp Tue Apr 28 16:09:30 2015 +0000
+++ b/GroveColourSensor.cpp Tue Apr 28 16:12:57 2015 +0000
@@ -26,7 +26,7 @@
return i2c->write((SEVEN_BIT_ADDRESS << 1), powerUpCommand, sizeof(powerUpCommand)) == 0;
}
-void GroveColourSensor::powerDown(void) {
+bool GroveColourSensor::powerDown(void) {
static const char powerDownCommand[] = {0x80, 0x00};
return i2c->write((SEVEN_BIT_ADDRESS << 1), powerDownCommand, sizeof(powerDownCommand)) == 0;
}
@@ -40,8 +40,8 @@
}
uint16_t GroveColourSensor::readColour(Colour_t colour) {
- char readColorRegistersCommand = 0xb0 + (2 * static_cast<unsigned>(colour));
- i2c->write((SEVEN_BIT_ADDRESS << 1), &readColorRegistersCommand, 1 /* size */);
+ char readColourRegistersCommand = 0xb0 + (2 * static_cast<unsigned>(colour));
+ i2c->write((SEVEN_BIT_ADDRESS << 1), &readColourRegistersCommand, 1 /* size */);
uint16_t colourValue;
i2c->read((SEVEN_BIT_ADDRESS << 1), reinterpret_cast<char *>(&colourValue), sizeof(uint16_t));
@@ -67,7 +67,7 @@
}
uint16_t GroveColourSensor::readColour(unsigned colour) {
- if (colour >= NUM_COLORS) {
+ if (colour >= NUM_COLOURS) {
return 0;
}
