blob: 6d86982bd7eefd34949fd604edb46375e2539e91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include <stdint.h>
#include <stdbool.h>
#include "tivaware.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{
uint8_t cur_color;
uint32_t port;
uint8_t red;
uint8_t yellow;
uint8_t green;
uint32_t prevPeriod;
} Traffic;
extern Traffic tf1;
extern Traffic tf2;
void set_tf_color(Traffic tf, uint8_t color);
void PortInit(uint32_t port, uint32_t clk);
void TimerInit(uint32_t timer, void(*timer_handler)(), uint32_t clk, uint32_t delay);
|