-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLEDDisplay.h
65 lines (53 loc) · 1.48 KB
/
LEDDisplay.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* LEDDisplay.h
*
* Created on: Mar 22, 2017
* Author: syedm_000
*/
#ifndef LEDDISPLAY_H_
#define LEDDISPLAY_H_
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* X latch
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* GPIO : P2.0
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#define X_LATCH_BIT BIT0
#define X_LATCH_PORT P2OUT
#define X_LATCH_DDR P2DIR
#define SET_X_LATCH_AS_AN_OUTPUT X_LATCH_DDR |= X_LATCH_BIT
#define RISE_X_LATCH X_LATCH_PORT |= X_LATCH_BIT
#define FALL_X_LATCH X_LATCH_PORT &= (~X_LATCH_BIT)
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* BLANK
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* GPIO : P1.4
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#define BLANK_BIT BIT4
#define BLANK_PORT P1OUT
#define BLANK_DDR P1DIR
#define SET_BLANK_AS_AN_OUTPUT BLANK_DDR |= BLANK_BIT
#define RISE_BLANK BLANK_PORT |= BLANK_BIT
#define FALL_BLANK BLANK_PORT &= (~BLANK_BIT)
//Bits which need to be on for each direction
#define no 0x80
#define ne 0x40
#define e 0x20
#define se 0x10
#define s 0x08
#define sw 0x04
#define w 0x02
#define nw 0x01
typedef enum
{
NW, W, SW, S, SE, E, NE, No, All, None, ZP, ZN
} LEDDirection;
void initializeDisplay(void);
void updateDisplay(unsigned char led);
void modifyLED(LEDDirection dir, int intensity );
void setLevelLEDs(LEDDirection dir);
//Displays the value into base 10 representation on the display
void sendCount(int digit);
void milestone2();
#endif /* LEDDISPLAY_H_ */