Rev 996 | Rev 1155 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 996 | Rev 998 | ||
|---|---|---|---|
| Line 5... | Line 5... | ||
| 5 | 5 | ||
| 6 | void act_hd44780_Init(void) |
6 | void act_hd44780_Init(void) |
| 7 | { |
7 | { |
| 8 | ///FIXME: What is this, this needs to be more clear by far.... |
8 | ///FIXME: What is this, this needs to be more clear by far.... |
| 9 | 9 | ||
| 10 | // Contrast |
10 | // Contrast (brightness on an oled display) |
| 11 | TCCR0A |= (1<<COM0B1)|(1<<WGM01)|(1<<WGM00); |
11 | TCCR0A |= (1<<COM0B1)|(1<<WGM01)|(1<<WGM00); |
| 12 | TCCR0B |= (1<<CS00); |
12 | TCCR0B |= (1<<CS00); |
| 13 | OCR0B = act_hd44780_INITIAL_CONTRAST; |
13 | OCR0B = act_hd44780_INITIAL_CONTRAST; |
| 14 | DDRD |= (1<<DDD5); |
14 | DDRD |= (1<<DDD5); |
| 15 | 15 | ||
| Line 80... | Line 80... | ||
| 80 | 80 | ||
| 81 | StdCan_Put(&txMsg); |
81 | StdCan_Put(&txMsg); |
| 82 | break; |
82 | break; |
| 83 | 83 | ||
| 84 | case CAN_MODULE_CMD_HD44789_LCD_BACKLIGHT: |
84 | case CAN_MODULE_CMD_HD44789_LCD_BACKLIGHT: |
| 85 | if (rxMsg->Length > 0) |
85 | if (rxMsg->Length > 0) { |
| - | 86 | #if (act_hd44780_TYPE==0) |
|
| 86 | OCR1AL = rxMsg->Data[0]; |
87 | OCR1AL = rxMsg->Data[0]; |
| - | 88 | #else |
|
| - | 89 | OCR0B = rxMsg->Data[0]; |
|
| - | 90 | #endif |
|
| - | 91 | } |
|
| 87 | 92 | ||
| 88 | StdCan_Msg_t txMsg; |
93 | StdCan_Msg_t txMsg; |
| 89 | 94 | ||
| 90 | StdCan_Set_class(txMsg.Header, CAN_MODULE_CLASS_ACT); |
95 | StdCan_Set_class(txMsg.Header, CAN_MODULE_CLASS_ACT); |
| 91 | StdCan_Set_direction(txMsg.Header, DIRECTIONFLAG_FROM_OWNER); |
96 | StdCan_Set_direction(txMsg.Header, DIRECTIONFLAG_FROM_OWNER); |
| 92 | txMsg.Header.ModuleType = CAN_MODULE_TYPE_ACT_HD44789; |
97 | txMsg.Header.ModuleType = CAN_MODULE_TYPE_ACT_HD44789; |
| 93 | txMsg.Header.ModuleId = act_hd44780_ID; |
98 | txMsg.Header.ModuleId = act_hd44780_ID; |
| 94 | txMsg.Header.Command = CAN_MODULE_CMD_HD44789_LCD_BACKLIGHT; |
99 | txMsg.Header.Command = CAN_MODULE_CMD_HD44789_LCD_BACKLIGHT; |
| 95 | txMsg.Length = 1; |
100 | txMsg.Length = 1; |
| 96 | 101 | ||
| - | 102 | #if (act_hd44780_TYPE==0) |
|
| 97 | txMsg.Data[0] = OCR1AL; |
103 | txMsg.Data[0] = OCR1AL; |
| - | 104 | #else |
|
| - | 105 | txMsg.Data[0] = OCR0B; |
|
| - | 106 | #endif |
|
| 98 | 107 | ||
| 99 | StdCan_Put(&txMsg); |
108 | StdCan_Put(&txMsg); |
| 100 | break; |
109 | break; |
| 101 | } |
110 | } |
| 102 | } |
111 | } |