Skip to content

Commit bd35dd6

Browse files
committed
Replace occurrences of white LED with orange LED
1 parent e557a63 commit bd35dd6

File tree

8 files changed

+56
-56
lines changed

8 files changed

+56
-56
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This library contains an API to read data from the Nicla Sense Env board and con
99
This library supports the complete API exposed by the Nicla Sense Env sensor board over I2C.
1010

1111
- 🌈 RGB LED control
12-
- ⚪️ White LED control
12+
- 🟠 Orange LED control
1313
- 💤 Board control (sleep, reset, factory reset)
1414
- 🔧 Board configuration (e.g. changing the I2C address)
1515
- 🏠 Indoor Air Quality Sensor control

docs/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ void setup(){
2121
// ...
2222
auto rgbLED = device.rgbLED();
2323
// ...
24-
auto whiteLED = device.whiteLED();
24+
auto orangeLED = device.orangeLED();
2525
// ...
2626
}
2727
}
2828
```
29-
Once the desired object is obtained you can call functions on these objects such as `temperatureSensor.getTemperature()`. A complete list of these functions can be found in the [API documentation](./api.md).
29+
Once the desired object is obtained you can call functions on these objects such as `temperatureSensor.temperature()`. A complete list of these functions can be found in the [API documentation](./api.md).
3030

3131
## 🧑‍💻 API
3232
The API documentation can be found [here](./api.md).
@@ -43,4 +43,4 @@ The following scripts are examples of how to use the Nicla Sense Env board with
4343
- [RGBLED.ino](../examples/RGBLED/RGBLED.ino): Demonstrates how to control the board's RGB LED.
4444
- [TemperatureHumidity.ino](../examples/TemperatureHumidity/TemperatureHumidity.ino): Demonstrates how to read the temperature and humidity data from the board's sensors.
4545
- [UARTRead.ino](../examples/UARTRead/UARTRead.ino): Shows how to read data from the UART port on the board when not connecting to it over I2C.
46-
- [WhiteLED.ino](../examples/WhiteLED/WhiteLED.ino): Demonstrates how to control the board's white LED.
46+
- [OrangeLED.ino](../examples/OrangeLED/OrangeLED.ino): Demonstrates how to control the board's orange LED.

examples/WhiteLED/WhiteLED.ino

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
2-
* This example shows how to control the white LED on the Nicla Sense Env board.
2+
* This example shows how to control the orange LED on the Nicla Sense Env board.
33
*
44
* Initial author: Sebastian Romero ([email protected])
55
*/
66

77
#include "NiclaSenseEnv.h"
88

9-
void pulseLED(WhiteLED& led) {
9+
void pulseLED(OrangeLED& led) {
1010
// Fade in
1111
for (uint8_t i = 0; i < 64; ++i) {
1212
led.setBrightness(i);
@@ -29,17 +29,17 @@ void setup() {
2929
NiclaSenseEnv device;
3030

3131
if (device.begin()) {
32-
auto whiteLED = device.whiteLED();
32+
auto orangeLED = device.orangeLED();
3333

34-
Serial.print("🔢 White LED error status enabled: ");
35-
Serial.println(whiteLED.errorStatusEnabled());
36-
Serial.print("💡 White LED brightness: ");
37-
Serial.println(whiteLED.brightness());
34+
Serial.print("🔢 Orange LED error status enabled: ");
35+
Serial.println(orangeLED.errorStatusEnabled());
36+
Serial.print("💡 Orange LED brightness: ");
37+
Serial.println(orangeLED.brightness());
3838

39-
pulseLED(whiteLED);
39+
pulseLED(orangeLED);
4040

41-
// Enable sensor error indication on white LED (LED should turn off if sensors are okay)
42-
whiteLED.setErrorStatusEnabled(true);
41+
// Enable sensor error indication on orange LED (LED should turn off if sensors are okay)
42+
orangeLED.setErrorStatusEnabled(true);
4343
} else {
4444
Serial.println("🤷 Device could not be found. Please double-check the wiring.");
4545
}

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version=1.0.0
33
author=Arduino
44
maintainer=Arduino <[email protected]>
55
sentence=Read sensor data from the Nicla Sense Env board and control the board behaviour.
6-
paragraph=This library comes with the following features to interact with the Nicla Sense Env board: RGB LED control, White LED control, Board control (sleep, reset, factory reset), Board configuration (e.g. changing the I2C address or enabling UART CSV output), Indoor Air Quality Sensor control, Outdoor Air Quality Sensor control, Temperature/Humidity Sensor Control, UART CSV output
6+
paragraph=This library comes with the following features to interact with the Nicla Sense Env board: RGB LED control, Orange LED control, Board control (sleep, reset, factory reset), Board configuration (e.g. changing the I2C address or enabling UART CSV output), Indoor Air Quality Sensor control, Outdoor Air Quality Sensor control, Temperature/Humidity Sensor Control, UART CSV output
77
category=Device Control
88
url=https://github.com/arduino-libraries/Arduino_NiclaSenseEnv
99
architectures=samd,mbed_portenta,renesas_portenta,renesas_uno,mbed_nicla,esp32,mbed_nano

src/NiclaSenseEnv.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ RGBLED& NiclaSenseEnv::rgbLED() {
4343
return *rgbLed;
4444
}
4545

46-
WhiteLED& NiclaSenseEnv::whiteLED() {
47-
if (!whiteLed) {
48-
whiteLed = new WhiteLED(this->bus, this->i2cDeviceAddress);
46+
OrangeLED& NiclaSenseEnv::orangeLED() {
47+
if (!orangeLed) {
48+
orangeLed = new OrangeLED(this->bus, this->i2cDeviceAddress);
4949
}
50-
return *whiteLed;
50+
return *orangeLed;
5151
}
5252

5353
void NiclaSenseEnv::end() {
@@ -67,9 +67,9 @@ void NiclaSenseEnv::end() {
6767
delete rgbLed;
6868
rgbLed = nullptr;
6969
}
70-
if (whiteLed) {
71-
delete whiteLed;
72-
whiteLed = nullptr;
70+
if (orangeLed) {
71+
delete orangeLed;
72+
orangeLed = nullptr;
7373
}
7474
}
7575

src/NiclaSenseEnv.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "IndoorAirQualitySensor.h"
77
#include "OutdoorAirQualitySensor.h"
88
#include "RGBLED.h"
9-
#include "WhiteLED.h"
9+
#include "OrangeLED.h"
1010

1111
/**
1212
* @brief The NiclaSenseEnv class represents a NiclaSenseEnv device.
@@ -69,11 +69,11 @@ class NiclaSenseEnv : public I2CDevice {
6969
RGBLED& rgbLED();
7070

7171
/**
72-
* @brief Returns a reference to the WhiteLED object to interact with the white LED.
72+
* @brief Returns a reference to the OrangeLED object to interact with the orange LED.
7373
*
74-
* @return WhiteLED& Reference to the WhiteLED object.
74+
* @return OrangeLED& Reference to the OrangeLED object.
7575
*/
76-
WhiteLED& whiteLED();
76+
OrangeLED& orangeLED();
7777

7878
/**
7979
* @brief Ends the operation of the NiclaSenseEnv class.
@@ -97,8 +97,8 @@ class NiclaSenseEnv : public I2CDevice {
9797
* - Indoor air quality sensor mode
9898
* - Outdoor air quality sensor mode
9999
* - Temperature sensor enabled
100-
* - White LED brightness
101-
* - White LED error status enabled
100+
* - Orange LED brightness
101+
* - Orange LED error status enabled
102102
* - RGB LED brightness
103103
* - RGB LED color
104104
*
@@ -250,7 +250,7 @@ class NiclaSenseEnv : public I2CDevice {
250250
IndoorAirQualitySensor* indoorAirQualitySensorInstance = nullptr;
251251
OutdoorAirQualitySensor* outdoorAirQualitySensorInstance = nullptr;
252252
RGBLED* rgbLed = nullptr;
253-
WhiteLED* whiteLed = nullptr;
253+
OrangeLED* orangeLed = nullptr;
254254
};
255255

256256
#endif

src/WhiteLED.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
#include "WhiteLED.h"
1+
#include "OrangeLED.h"
22

3-
WhiteLED::WhiteLED(TwoWire& bus, uint8_t deviceAddress) : I2CDevice(bus, deviceAddress) {}
3+
OrangeLED::OrangeLED(TwoWire& bus, uint8_t deviceAddress) : I2CDevice(bus, deviceAddress) {}
44

5-
WhiteLED::WhiteLED(uint8_t deviceAddress) : I2CDevice(deviceAddress) {}
5+
OrangeLED::OrangeLED(uint8_t deviceAddress) : I2CDevice(deviceAddress) {}
66

7-
uint8_t WhiteLED::brightness() {
8-
// Read bits 0 - 5 from white_led register
7+
uint8_t OrangeLED::brightness() {
8+
// Read bits 0 - 5 from orange_led register
99
uint8_t data = readFromRegister<uint8_t>(WHITE_LED_REGISTER_INFO);
1010
return data & 63;
1111
}
1212

13-
void WhiteLED::setBrightness(uint8_t brightness) {
13+
void OrangeLED::setBrightness(uint8_t brightness) {
1414
if (brightness > 63) {
1515
return; // Invalid brightness value
1616
}
@@ -20,13 +20,13 @@ void WhiteLED::setBrightness(uint8_t brightness) {
2020
writeToRegister<uint8_t>(WHITE_LED_REGISTER_INFO, (currentRegisterData & ~63) | brightness);
2121
}
2222

23-
bool WhiteLED::errorStatusEnabled() {
24-
// Read bit 7 from white_led register
23+
bool OrangeLED::errorStatusEnabled() {
24+
// Read bit 7 from orange_led register
2525
uint8_t data = readFromRegister<uint8_t>(WHITE_LED_REGISTER_INFO);
2626
return data & (1 << 7);
2727
}
2828

29-
void WhiteLED::setErrorStatusEnabled(bool enabled) {
29+
void OrangeLED::setErrorStatusEnabled(bool enabled) {
3030
uint8_t currentRegisterData = readFromRegister<uint8_t>(WHITE_LED_REGISTER_INFO);
3131
// Set bit 7 to 1 if enabled or 0 if disabled while keeping the other bits unchanged
3232
writeToRegister<uint8_t>(WHITE_LED_REGISTER_INFO, (currentRegisterData & ~(1 << 7)) | (enabled << 7));

src/WhiteLED.h

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
11
#include "I2CDevice.h"
22

33
/**
4-
* @brief Represents the white on-board LED controlled via I2C.
4+
* @brief Represents the orange on-board LED controlled via I2C.
55
*
6-
* The WhiteLED class provides methods to control the brightness and error status of the white LED.
6+
* The OrangeLED class provides methods to control the brightness and error status of the orange LED.
77
* It inherits from the I2CDevice class.
88
*/
9-
class WhiteLED : public I2CDevice {
9+
class OrangeLED : public I2CDevice {
1010
public:
1111

1212
/**
13-
* @brief Constructs a WhiteLED object.
13+
* @brief Constructs a OrangeLED object.
1414
*
1515
* @param bus The I2C bus to use (default is Wire).
1616
* @param deviceAddress The I2C device address (default is 0x21).
1717
*/
18-
WhiteLED(TwoWire& bus = Wire, uint8_t deviceAddress = DEFAULT_DEVICE_ADDRESS);
18+
OrangeLED(TwoWire& bus = Wire, uint8_t deviceAddress = DEFAULT_DEVICE_ADDRESS);
1919

2020
/**
21-
* @brief Constructs a WhiteLED object with the specified device address.
21+
* @brief Constructs a OrangeLED object with the specified device address.
2222
*
23-
* @param deviceAddress The I2C address of the WhiteLED device.
23+
* @param deviceAddress The I2C address of the OrangeLED device.
2424
*/
25-
WhiteLED(uint8_t deviceAddress);
25+
OrangeLED(uint8_t deviceAddress);
2626

2727
/**
28-
* Gets the brightness of the white LED.
29-
* @return The brightness of the white LED. Range is 0 to 63.
28+
* Gets the brightness of the orange LED.
29+
* @return The brightness of the orange LED. Range is 0 to 63.
3030
*/
3131
uint8_t brightness();
3232

3333
/**
34-
* Sets the brightness of the white LED.
35-
* Call storeSettingsInFlash() on NiclaSenseEnv instance after changing the white LED brightness to make the change persistent.
36-
* @param brightness : The brightness of the white LED. Range is 0 to 63.
34+
* Sets the brightness of the orange LED.
35+
* Call storeSettingsInFlash() on NiclaSenseEnv instance after changing the orange LED brightness to make the change persistent.
36+
* @param brightness : The brightness of the orange LED. Range is 0 to 63.
3737
*/
3838
void setBrightness(uint8_t brightness = 63);
3939

4040
/**
41-
* Determines whether the white LED is used to indicate an error status of one of the sensors.
42-
* @return True if the white LED is used for error status, false otherwise.
41+
* Determines whether the orange LED is used to indicate an error status of one of the sensors.
42+
* @return True if the orange LED is used for error status, false otherwise.
4343
*/
4444
bool errorStatusEnabled();
4545

4646
/**
47-
* Enables or disables the white LED to indicate an error status of one of the sensors.
48-
* Call storeSettingsInFlash() on NiclaSenseEnv instance after enabling/disabling the white LED error status to make the change persistent.
49-
* @param enabled : Whether to enable or disable the white LED error status.
47+
* Enables or disables the orange LED to indicate an error status of one of the sensors.
48+
* Call storeSettingsInFlash() on NiclaSenseEnv instance after enabling/disabling the orange LED error status to make the change persistent.
49+
* @param enabled : Whether to enable or disable the orange LED error status.
5050
*/
5151
void setErrorStatusEnabled(bool enabled);
5252
};

0 commit comments

Comments
 (0)