Skip to content

Commit 42fede9

Browse files
author
MiK
committed
Added user function for Yellow Led.
Same as it happen for the RGB, the user function do the inversion of the Light on/off required by the led mounted on the SME. The user continue to use HIGH to light on and LOW to light off the digital pin.
1 parent 2268291 commit 42fede9

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

hardware/AMEL/samd/variants/AMEL_SmartEverything/variant.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,25 @@ void SERCOM5_Handler()
272272
BLE.IrqHandler();
273273
}
274274

275+
void ledYellowTwoLight(uint32_t value) {
276+
if (value == HIGH) {
277+
digitalWrite(PIN_LED_RXL, LOW);
278+
} else if (value == LOW) {
279+
digitalWrite(PIN_LED_RXL, HIGH);
280+
} else {
281+
analogWrite(PIN_LED_RXL, 255-value); // in case of PWM
282+
}
283+
}
284+
285+
void ledYellowOneLight(uint32_t value) {
286+
if (value == HIGH) {
287+
digitalWrite(PIN_LED_TXL, LOW);
288+
} else if (value == LOW) {
289+
digitalWrite(PIN_LED_TXL, HIGH);
290+
} else {
291+
analogWrite(PIN_LED_TXL, 255-value); // in case of PWM
292+
}
293+
}
275294

276295
void ledGreenLight(uint32_t value) {
277296
if (value == HIGH) {

hardware/AMEL/samd/variants/AMEL_SmartEverything/variant.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,18 @@ void ledGreenLight(uint32_t value);
191191
void ledRedLight(uint32_t value);
192192
void ledBlueLight(uint32_t value);
193193

194+
/*
195+
Yellow Led wrapper function
196+
These functions has been created for a more comfortable use
197+
because internally wrap the inversion of the HIGH, LOW meaning
198+
199+
Using these function it remain the same Arduino User Experience to light a led
200+
HIGH = Light ON
201+
LOW = Light OFF
202+
203+
*/
204+
void ledYellowOneLight(uint32_t value);
205+
void ledYellowTwoLight(uint32_t value);
194206

195207
/*
196208
User Button wrapper function.
@@ -258,6 +270,9 @@ extern Uart SigFox;
258270
#define LED_RED_INIT pinMode(PIN_LED_RED, OUTPUT)
259271
#define LED_BLUE_INIT pinMode(PIN_LED_BLUE, OUTPUT)
260272

273+
#define LED_YELLOW_TWO_INIT pinMode(PIN_LED_RXL, OUTPUT)
274+
#define LED_YELLOW_ONE_INIT pinMode(PIN_LED_TXL, OUTPUT)
275+
261276

262277
extern uint8_t smeInitError;
263278
#endif /* _VARIANT_AMEL_SMARTEVERYTHING_ */

hardware/AMEL/samd/variants/AMEL_SmartEverything/variantInit.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ static void ioExtenderInit(void) {
150150

151151

152152
void initVariant() {
153+
154+
// initializa the two Yellow Led
155+
LED_YELLOW_ONE_INIT;
156+
LED_YELLOW_TWO_INIT;
157+
153158
// reset the I/O Extender
154159
pinMode(PIN_IO_EXT_RST, OUTPUT);
155160
digitalWrite(PIN_IO_EXT_RST, LOW);

0 commit comments

Comments
 (0)