summaryrefslogtreecommitdiff
path: root/color.c
diff options
context:
space:
mode:
authorOmar Magdy <omar.professional8777@gmail.com>2022-08-22 14:03:01 +0200
committerOmar Magdy <omar.professional8777@gmail.com>2022-08-22 14:03:01 +0200
commit5aa3477c59aec1ebedf2a70d8aebfed0d9d23a77 (patch)
treee37092cb435d7d51927daeb095504acf4c866ad0 /color.c
parentfe2d03c9c7997d647ffb0b2856e766d54090e419 (diff)
downloadTraffic-light-5aa3477c59aec1ebedf2a70d8aebfed0d9d23a77.tar.xz
Traffic-light-5aa3477c59aec1ebedf2a70d8aebfed0d9d23a77.zip
Added initial code + Made the led stay green for 5 seconds then yellow for 2 seconds then red
Diffstat (limited to 'color.c')
-rw-r--r--color.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/color.c b/color.c
index 967350f..9806979 100644
--- a/color.c
+++ b/color.c
@@ -1,9 +1,6 @@
#include "color.h"
#include <stdint.h>
-#define LED_RED (1U << 1)
-#define LED_BLUE (1U << 2)
-#define LED_GREEN (1U << 3)
void set_color(uint8_t color) {
switch (color) {
@@ -16,6 +13,9 @@ void set_color(uint8_t color) {
case GREEN:
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, 0x8);
break;
+ case YELLOW:
+ GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, 0xA);
+ break;
case WHITE:
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, 0xe);
break;