diff options
| author | Omar Magdy <omar.professional8777@gmail.com> | 2022-08-23 12:32:39 +0200 |
|---|---|---|
| committer | Omar Magdy <omar.professional8777@gmail.com> | 2022-08-23 12:32:39 +0200 |
| commit | b5c1df30961369762e6c9ead8a11f8c9d0f5f8a3 (patch) | |
| tree | 3f2f6583b0b302d56ab88ef476f1c4fcbce510b2 /trafficlight.h | |
| parent | 5a180583b8835b564d519c8a2548edc92a01842e (diff) | |
| download | Traffic-light-b5c1df30961369762e6c9ead8a11f8c9d0f5f8a3.tar.xz Traffic-light-b5c1df30961369762e6c9ead8a11f8c9d0f5f8a3.zip | |
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.
Diffstat (limited to 'trafficlight.h')
| -rw-r--r-- | trafficlight.h | 12 |
1 files changed, 12 insertions, 0 deletions
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 <stdint.h> +#include <stdbool.h> +#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); |
