-
Notifications
You must be signed in to change notification settings - Fork 18
/
led.h
40 lines (32 loc) · 1003 Bytes
/
led.h
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
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef _LED_H_
#define _LED_H_
#define LED_DDR (DDRB)
#define LED_PORT (PORTB)
#define LED_RED (1)
#define LED_GREEN (0)
#define LED_Init() LED_OUTPUT()
#define LED_OUTPUT() (LED_DDR |= (1<<LED_RED) | (1<<LED_GREEN))
#define LED_HIGH(LED) (LED_PORT |= (1<<LED))
#define LED_LOW(LED) (LED_PORT &= ~(1<<LED))
#define LED_ON LED_HIGH
#define LED_OFF LED_LOW
#define LED_TOGGLE(LED) (LED_PORT ^= (1<<LED))
#define LED_Off() {led = OFF; }
#define LED_Red() {led = RED; }
#define LED_Green() {led = GREEN; }
#define LED_BlinkRed() {led = BLINK_RED; }
#define LED_BlinkGreen() {led = BLINK_GREEN; }
#define LED_BlinkBoth() {led = BLINK_BOTH; }
/* Typedefs */
typedef enum{
OFF,
RED,
GREEN,
BLINK_RED,
BLINK_GREEN,
BLINK_BOTH
} ledStatus_t;
extern ledStatus_t led;
/* Main LED Task function */
extern void LED_Task(void);
#endif /* _LED_H_ */