From b5c1df30961369762e6c9ead8a11f8c9d0f5f8a3 Mon Sep 17 00:00:00 2001 From: Omar Magdy Date: Tue, 23 Aug 2022 12:32:39 +0200 Subject: Added two timers and made them sync the 2 traffic lights as when one traffic light is green the other is red and vice versa. --- trafficlight.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 trafficlight.h (limited to 'trafficlight.h') diff --git a/trafficlight.h b/trafficlight.h new file mode 100644 index 0000000..52ba584 --- /dev/null +++ b/trafficlight.h @@ -0,0 +1,12 @@ +#include +#include +#include "color.h" +#include "dio.h" + +#define TIVA_CLK 16e6 +#define GREEN_PERIOD TIVA_CLK * 5 +#define YELLOW_PERIOD TIVA_CLK * 2 +#define RED_PERIOD TIVA_CLK * 7 + +void PortInit(uint32_t port, uint32_t clk); +void TimerInit(uint32_t timer, void(*timer_handler)(), uint32_t clk, uint32_t delay); -- cgit v1.2.3