Rev 1005 | Rev 1017 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1005 | Rev 1006 | ||
|---|---|---|---|
| Line 9... | Line 9... | ||
| 9 | 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x83,0xfc,0xff,0xff,0xff,0xff,0x9f,0xe0,0xf8,0xf0,0xf0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0,0xf0,0xf8,0xe0,0x1f,0xff,0xff,0xff,0xff,0xfc,0x83,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0xff,//Line 5 |
9 | 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x83,0xfc,0xff,0xff,0xff,0xff,0x9f,0xe0,0xf8,0xf0,0xf0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf0,0xf0,0xf8,0xe0,0x1f,0xff,0xff,0xff,0xff,0xfc,0x83,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0xff,//Line 5 |
| 10 | 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0xff,0xff,0xff,0x1f,0xe1,0xfe,0xff,0xff,0x7f,0x1f,0x7,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x1f,0x7f,0xff,0xff,0xfe,0xe1,0x1f,0xff,0xff,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0x3,0xb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xb,0x3,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfc,0xff,//Line 6 |
10 | 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0xff,0xff,0xff,0x1f,0xe1,0xfe,0xff,0xff,0x7f,0x1f,0x7,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x1f,0x7f,0xff,0xff,0xfe,0xe1,0x1f,0xff,0xff,0xff,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0x3,0xb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xb,0x3,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfc,0xff,//Line 6 |
| 11 | 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7,0xf8,0xff,0xff,0xf,0xf0,0xff,0xff,0xf,0x13,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x13,0xf,0xff,0xff,0xf0,0xf,0xff,0xff,0xf8,0x7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,//Line 7 |
11 | 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7,0xf8,0xff,0xff,0xf,0xf0,0xff,0xff,0xf,0x13,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x13,0xf,0xff,0xff,0xf0,0xf,0xff,0xff,0xf8,0x7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,//Line 7 |
| 12 | 0xff,0xbf,0x5f,0x5f,0x6f,0x77,0x79,0x7e,0x9f,0x7f,0x87,0xf8,0xff,0xff,0xff,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf8,0xf8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0xff,0xff,0xff,0xf8,0x87,0x7f,0x9f,0x7e,0x79,0x77,0x6f,0x5f,0x5f,0xbf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x0,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff//Line 7 |
12 | 0xff,0xbf,0x5f,0x5f,0x6f,0x77,0x79,0x7e,0x9f,0x7f,0x87,0xf8,0xff,0xff,0xff,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf8,0xf8,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0xff,0xff,0xff,0xf8,0x87,0x7f,0x9f,0x7e,0x79,0x77,0x6f,0x5f,0x5f,0xbf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x0,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff//Line 7 |
| 13 | }; |
13 | }; |
| 14 | uint16_t ixa = 0; |
- | |
| 15 | uint8_t jxa = 0; |
- | |
| 16 | uint16_t sensor_Temperature = 12.7*(2<<(SNS_DECPOINT_VOLTAGE-1)); |
- | |
| 17 | - | ||
| 18 | 14 | ||
| 19 | void numtoascii( int16_t num, char **str ); |
15 | void numtoascii( int16_t num, char **str ); |
| 20 | void signedtoascii(int16_t num, uint8_t decimalplace, char *string, uint8_t numberofdecimals); |
16 | void signedtoascii(int16_t num, uint8_t decimalplace, char *string, uint8_t numberofdecimals); |
| 21 | void unsignedtoascii(uint16_t num, uint8_t decimalplace, char *string, uint8_t numberofdecimals); |
17 | void unsignedtoascii(uint16_t num, uint8_t decimalplace, char *string, uint8_t numberofdecimals); |
| 22 | 18 | ||
| 23 | void act_ks0108_Init(void) |
19 | void act_ks0108_Init(void) |
| 24 | { |
20 | { |
| 25 | ///TODO: Initialize hardware etc here |
21 | ///TODO: Initialize hardware etc here |
| 26 | DDRC |= (1<<PC0); |
22 | DDRC |= (1<<PC0); |
| 27 | PORTC |= (1<<PC0); |
23 | PORTC |= (1<<PC0); |
| 28 | 24 | ||
| 29 | glcdPowerOn(); |
25 | glcdPowerOn(); |
| 30 | 26 | ||
| - | 27 | uint16_t ixa = 0; |
|
| - | 28 | uint8_t jxa = 0; |
|
| 31 | for (jxa = 0; jxa< 8; jxa++){ |
29 | for (jxa = 0; jxa< 8; jxa++){ |
| 32 | glcdSetXY(0,jxa); |
30 | glcdSetXY(0,jxa); |
| 33 | for (ixa = 0; ixa < 128; ixa++){ |
31 | for (ixa = 0; ixa < 128; ixa++){ |
| 34 | glcdWriteData((uint8_t)pgm_read_byte((uint16_t)&Splash_left+ixa+jxa*128)); |
32 | glcdWriteData((uint8_t)pgm_read_byte((uint16_t)&Splash_left+ixa+jxa*128)); |
| 35 | } |
33 | } |
| 36 | } |
34 | } |
| 37 | } |
35 | } |
| 38 | 36 | ||
| 39 | void act_ks0108_Process(void) |
37 | void act_ks0108_Process(void) |
| 40 | { |
38 | { |
| 41 | ///TODO: Stuff that needs doing is done here |
39 | ///TODO: Stuff that needs doing is done here |
| 42 | } |
40 | } |
| 43 | 41 | ||
| 44 | void act_ks0108_HandleMessage(StdCan_Msg_t *rxMsg) |
42 | void act_ks0108_HandleMessage(StdCan_Msg_t *rxMsg) |
| 45 | { |
43 | { |
| - | 44 | StdCan_Msg_t txMsg; |
|
| - | 45 | uint8_t n = 0; |
|
| - | 46 | ||
| - | 47 | if ( StdCan_Ret_class(rxMsg->Header) == CAN_MODULE_CLASS_ACT && |
|
| - | 48 | StdCan_Ret_direction(rxMsg->Header) == DIRECTIONFLAG_TO_OWNER && |
|
| - | 49 | rxMsg->Header.ModuleType == CAN_MODULE_TYPE_ACT_KS0108 && |
|
| - | 50 | rxMsg->Header.ModuleId == act_ks0108_ID) |
|
| - | 51 | { |
|
| - | 52 | switch (rxMsg->Header.Command) |
|
| - | 53 | { |
|
| - | 54 | case CAN_MODULE_CMD_KS0108_LCD_CLEAR: |
|
| - | 55 | glcdClear(); |
|
| - | 56 | break; |
|
| - | 57 | ||
| - | 58 | case CAN_MODULE_CMD_KS0108_LCD_CURSOR: |
|
| - | 59 | glcdSetXY(rxMsg->Data[0], rxMsg->Data[1]); |
|
| - | 60 | break; |
|
| - | 61 | ||
| - | 62 | case CAN_MODULE_CMD_KS0108_LCD_TEXTAT: |
|
| - | 63 | glcdSetXY(rxMsg->Data[0], rxMsg->Data[1]); |
|
| - | 64 | for (n = 2; n < rxMsg->Length; n++) |
|
| - | 65 | { |
|
| - | 66 | glcdWriteChar((char)rxMsg->Data[n]); |
|
| - | 67 | } |
|
| - | 68 | break; |
|
| - | 69 | ||
| - | 70 | case CAN_MODULE_CMD_KS0108_LCD_TEXT: |
|
| - | 71 | for (n = 0; n < rxMsg->Length; n++) |
|
| - | 72 | { |
|
| - | 73 | glcdWriteChar((char)rxMsg->Data[n]); |
|
| - | 74 | } |
|
| - | 75 | break; |
|
| - | 76 | ||
| - | 77 | case CAN_MODULE_CMD_KS0108_LCD_BACKLIGHT: |
|
| - | 78 | if (rxMsg->Length > 0) { |
|
| - | 79 | if (rxMsg->Data[0] > 127) |
|
| - | 80 | PORTC |= (1<<PC0); |
|
| - | 81 | else |
|
| - | 82 | PORTC &= ~(1<<PC0); |
|
| - | 83 | /* |
|
| - | 84 | #if (act_hd44780_TYPE==0) |
|
| - | 85 | OCR1AL = rxMsg->Data[0]; |
|
| - | 86 | #else |
|
| - | 87 | OCR0B = rxMsg->Data[0]; |
|
| - | 88 | #endif |
|
| - | 89 | */ |
|
| - | 90 | } |
|
| - | 91 | ||
| - | 92 | StdCan_Msg_t txMsg; |
|
| - | 93 | ||
| - | 94 | StdCan_Set_class(txMsg.Header, CAN_MODULE_CLASS_ACT); |
|
| - | 95 | StdCan_Set_direction(txMsg.Header, DIRECTIONFLAG_FROM_OWNER); |
|
| - | 96 | txMsg.Header.ModuleType = CAN_MODULE_TYPE_ACT_KS0108; |
|
| - | 97 | txMsg.Header.ModuleId = act_ks0108_ID; |
|
| - | 98 | txMsg.Header.Command = CAN_MODULE_CMD_KS0108_LCD_BACKLIGHT; |
|
| - | 99 | txMsg.Length = 1; |
|
| - | 100 | ||
| - | 101 | txMsg.Data[0] = PORTC & (1<<PC0); |
|
| - | 102 | /* |
|
| - | 103 | #if (act_hd44780_TYPE==0) |
|
| - | 104 | txMsg.Data[0] = OCR1AL; |
|
| - | 105 | #else |
|
| - | 106 | txMsg.Data[0] = OCR0B; |
|
| - | 107 | #endif |
|
| - | 108 | */ |
|
| - | 109 | ||
| - | 110 | while (StdCan_Put(&txMsg) != StdCan_Ret_OK); |
|
| - | 111 | break; |
|
| - | 112 | } |
|
| - | 113 | } |
|
| - | 114 | /* |
|
| 46 | static uint8_t saer=0; |
115 | static uint8_t saer=0; |
| 47 | static uint8_t saer2=0; |
116 | static uint8_t saer2=0; |
| 48 | saer++; |
117 | saer++; |
| 49 | if (saer>10) { |
118 | if (saer>10) { |
| 50 | saer2++; |
119 | saer2++; |
| - | 120 | uint8_t ixa = 0; |
|
| - | 121 | uint8_t jxa = 0; |
|
| 51 | for (jxa = 0; jxa< 8; jxa++){ |
122 | for (jxa = 0; jxa< 8; jxa++){ |
| 52 | glcdSetXY(0,jxa); |
123 | glcdSetXY(0,jxa); |
| 53 | for (ixa = 0; ixa < 128; ixa++){ |
124 | for (ixa = 0; ixa < 128; ixa++){ |
| 54 | glcdWriteData((uint8_t)pgm_read_byte((uint16_t)&Splash_left+ixa+jxa*128)); |
125 | glcdWriteData((uint8_t)pgm_read_byte((uint16_t)&Splash_left+ixa+jxa*128)); |
| 55 | } |
126 | } |
| Line 65... | Line 136... | ||
| 65 | char buffer[20]; |
136 | char buffer[20]; |
| 66 | //numtoascii((int16_t)saer2 ,*buffer); |
137 | //numtoascii((int16_t)saer2 ,*buffer); |
| 67 | unsignedtoascii((int16_t)saer2,0,buffer,1); |
138 | unsignedtoascii((int16_t)saer2,0,buffer,1); |
| 68 | glcdPutStr(buffer); |
139 | glcdPutStr(buffer); |
| 69 | } |
140 | } |
| - | 141 | */ |
|
| 70 | } |
142 | } |
| 71 | 143 | ||
| 72 | void act_ks0108_List(uint8_t ModuleSequenceNumber) |
144 | void act_ks0108_List(uint8_t ModuleSequenceNumber) |
| 73 | { |
145 | { |
| 74 | StdCan_Msg_t txMsg; |
146 | StdCan_Msg_t txMsg; |