diff options
| author | Omar Magdy <omar.professional8777@gmail.com> | 2022-08-23 17:26:28 +0200 |
|---|---|---|
| committer | Omar Magdy <omar.professional8777@gmail.com> | 2022-08-23 17:26:28 +0200 |
| commit | 8a5f32723ef73e25fd6a19d199e1f3f1f1ca7f94 (patch) | |
| tree | 47b4bd0bd8682833a602d8f1ffee805231321b84 | |
| parent | e304ce76cb2e66b3009cee4386d9de098e09ce94 (diff) | |
| download | Traffic-light-8a5f32723ef73e25fd6a19d199e1f3f1f1ca7f94.tar.xz Traffic-light-8a5f32723ef73e25fd6a19d199e1f3f1f1ca7f94.zip | |
Removed color.h and color.c
| -rw-r--r-- | main.c | 6 | ||||
| -rw-r--r-- | trafficlight.h | 5 |
2 files changed, 7 insertions, 4 deletions
@@ -4,9 +4,9 @@ uint32_t period_1 = RED_PERIOD; uint32_t period_2 = GREEN_PERIOD;
uint32_t period_3 = RED_PERIOD;
-Traffic tf1 = {RED, GPIO_PORTF_BASE, 1, 2, 3};
-Traffic tf2 = {YELLOW, GPIO_PORTA_BASE, 2, 3, 4};
-Traffic tf_ped = {RED, GPIO_PORTB_BASE, 5, 0, 1};
+Traffic tf1 = {RED , GPIO_PORTF_BASE, 1, 2, 3, 0};
+Traffic tf2 = {YELLOW, GPIO_PORTA_BASE, 2, 3, 4, 0};
+Traffic tf_ped = {RED , GPIO_PORTB_BASE, 5, 0, 1, 0};
void Switch_Handler() {
diff --git a/trafficlight.h b/trafficlight.h index 2f8f33d..6d86982 100644 --- a/trafficlight.h +++ b/trafficlight.h @@ -1,12 +1,14 @@ #include <stdint.h> #include <stdbool.h> #include "tivaware.h" -#include "color.h" #define TIVA_CLK 16e6 #define GREEN_PERIOD TIVA_CLK * 5 #define YELLOW_PERIOD TIVA_CLK * 2 #define RED_PERIOD TIVA_CLK * 7 +#define RED 1 +#define YELLOW 2 +#define GREEN 3 typedef struct Traffic{ @@ -15,6 +17,7 @@ typedef struct Traffic{ uint8_t red; uint8_t yellow; uint8_t green; + uint32_t prevPeriod; } Traffic; extern Traffic tf1; |
