Rev 436 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 436 | Rev 765 | ||
---|---|---|---|
Line 13... | Line 13... | ||
13 | #include "timer0.h" |
13 | #include "timer0.h" |
14 | #include "main.h" |
14 | #include "main.h" |
Line 15... | Line 15... | ||
15 | 15 | ||
16 | uint8_t MaxMenuItem = 3; |
16 | uint8_t MaxMenuItem = 3; |
17 | uint8_t MenuItem = 0; |
- | |
Line 18... | Line 17... | ||
18 | uint8_t RemoteKeys = 0; |
17 | uint8_t MenuItem = 0; |
19 | 18 | ||
20 | #define KEY1 0x01 |
19 | #define KEY1 0x01 |
21 | #define KEY2 0x02 |
20 | #define KEY2 0x02 |
Line 31... | Line 30... | ||
31 | 30 | ||
32 | 31 | ||
33 | /************************************/ |
32 | /************************************/ |
34 | /* Clear LCD Buffer */ |
33 | /* Clear LCD Buffer */ |
35 | /************************************/ |
34 | /************************************/ |
36 | void LCD_Clear(void) |
35 | void Menu_Clear(void) |
37 | { |
36 | { |
38 | uint8_t i; |
37 | uint8_t i; |
Line 39... | Line 38... | ||
39 | for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' '; |
38 | for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' '; |
40 | } |
39 | } |
41 | 40 | ||
42 | 41 | ||
43 | /************************************/ |
42 | /************************************/ |
44 | /* Update Menu on LCD */ |
43 | /* Update Menu on LCD */ |
45 | /************************************/ |
44 | /************************************/ |
46 | // Display with 20 characters in 4 lines |
45 | // Display with 20 characters in 4 lines |
Line 47... | Line 46... | ||
47 | void LCD_PrintMenu(void) |
46 | void Menu_Update(uint8_t Keys) |
48 | { |
47 | { |
49 | int16_t i1,i2,i3; |
48 | int16_t i1,i2,i3; |
50 | uint8_t sign; |
49 | uint8_t sign; |
51 | 50 | ||
52 | if(RemoteKeys & KEY1) |
51 | if(Keys & KEY1) |
53 | { |
52 | { |
54 | if(MenuItem) MenuItem--; |
53 | if(MenuItem) MenuItem--; |
55 | else MenuItem = MaxMenuItem; |
54 | else MenuItem = MaxMenuItem; |
56 | } |
55 | } |
57 | if(RemoteKeys & KEY2) |
56 | if(Keys & KEY2) |
58 | { |
57 | { |
59 | if(MenuItem == MaxMenuItem) MenuItem = 0; |
58 | if(MenuItem == MaxMenuItem) MenuItem = 0; |
60 | else MenuItem++; |
59 | else MenuItem++; |
61 | } |
60 | } |
62 | /* |
61 | /* |
63 | if(RemoteKeys & KEY4) |
62 | if(Keys & KEY4) |
Line 75... | Line 74... | ||
75 | default: |
74 | default: |
76 | SysState = STATE_IDLE; |
75 | SysState = STATE_IDLE; |
77 | break; |
76 | break; |
78 | } |
77 | } |
79 | }*/ |
78 | }*/ |
80 | if((RemoteKeys & KEY1) && (RemoteKeys & KEY2)) MenuItem = 0; |
79 | if((Keys & KEY1) && (Keys & KEY2)) MenuItem = 0; |
Line 81... | Line 80... | ||
81 | 80 | ||
Line 82... | Line 81... | ||
82 | LCD_Clear(); |
81 | Menu_Clear(); |
83 | 82 | ||
84 | if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem; |
83 | if(MenuItem > MaxMenuItem) MenuItem = MaxMenuItem; |
85 | // print menu item number in the upper right corner |
84 | // print menu item number in the upper right corner |
Line 197... | Line 196... | ||
197 | 196 | ||
198 | default: MaxMenuItem = MenuItem - 1; |
197 | default: MaxMenuItem = MenuItem - 1; |
199 | MenuItem = 0; |
198 | MenuItem = 0; |
200 | break; |
199 | break; |
201 | } |
- | |
202 | RemoteKeys = 0; |
200 | } |