Subversion Repositories HomeAutomation

Rev

Rev 1038 | Rev 1188 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1038 Rev 1187
Line 21... Line 21...
21
void unsignedtoascii(uint16_t num, uint8_t decimalplace, char *string, uint8_t numberofdecimals);
21
void unsignedtoascii(uint16_t num, uint8_t decimalplace, char *string, uint8_t numberofdecimals);
22
 
22
 
23
void act_ks0108_Init(void)
23
void act_ks0108_Init(void)
24
{
24
{
25
    ///TODO: Initialize hardware etc here
25
    ///TODO: Initialize hardware etc here
-
 
26
    // Backlight
-
 
27
    TCCR0A |= (1<<COM0A1)|(1<<WGM01)|(1<<WGM00);
26
    DDRC |= (1<<PC0);
28
    TCCR0B |= (1<<CS00);
-
 
29
    OCR0A = act_hd44780_INITIAL_BACKLIGHT;
27
    PORTC |= (1<<PC0);
30
    DDRD |= (1<<PD6);
28
 
31
 
29
    glcdPowerOn();
32
    glcdPowerOn();
30
 
33
 
31
    uint16_t ixa = 0;
34
    uint16_t ixa = 0;
32
    uint8_t jxa = 0;
35
    uint8_t jxa = 0;
Line 130... Line 133...
130
        }
133
        }
131
        break;
134
        break;
132
 
135
 
133
        case CAN_MODULE_CMD_KS0108_LCD_BACKLIGHT:
136
        case CAN_MODULE_CMD_KS0108_LCD_BACKLIGHT:
134
        if (rxMsg->Length > 0) {
137
            if (rxMsg->Length > 0) {
135
          if (rxMsg->Data[0] > 127)
-
 
136
            PORTC |= (1<<PC0);
-
 
137
          else
-
 
138
            PORTC &= ~(1<<PC0);
-
 
139
/*
-
 
140
#if (act_hd44780_TYPE==0)
-
 
141
            OCR1AL = rxMsg->Data[0];
-
 
142
#else
-
 
143
            OCR0B = rxMsg->Data[0];
138
                OCR0A = rxMsg->Data[0];
144
#endif
-
 
145
*/
-
 
146
        }
139
            }
-
 
140
            StdCan_Msg_t txMsg;
147
        StdCan_Set_class(txMsg.Header, CAN_MODULE_CLASS_ACT);
141
            StdCan_Set_class(txMsg.Header, CAN_MODULE_CLASS_ACT);
148
        StdCan_Set_direction(txMsg.Header, DIRECTIONFLAG_FROM_OWNER);
142
            StdCan_Set_direction(txMsg.Header, DIRECTIONFLAG_FROM_OWNER);
149
        txMsg.Header.ModuleType = CAN_MODULE_TYPE_ACT_KS0108;
143
            txMsg.Header.ModuleType = CAN_MODULE_TYPE_ACT_KS0108;
150
        txMsg.Header.ModuleId = act_ks0108_ID;
144
            txMsg.Header.ModuleId = act_ks0108_ID;
151
        txMsg.Header.Command = CAN_MODULE_CMD_KS0108_LCD_BACKLIGHT;
145
            txMsg.Header.Command = CAN_MODULE_CMD_KS0108_LCD_BACKLIGHT;
152
        txMsg.Length = 1;
146
            txMsg.Length = 1;
153
       
-
 
154
        txMsg.Data[0] = PORTC & (1<<PC0);
-
 
155
/*
-
 
156
#if (act_hd44780_TYPE==0)
-
 
157
            txMsg.Data[0] = OCR1AL;
-
 
158
#else
-
 
159
            txMsg.Data[0] = OCR0B;
147
            txMsg.Data[0] = OCR0A;
160
#endif
-
 
161
*/
-
 
162
 
-
 
163
        while (StdCan_Put(&txMsg) != StdCan_Ret_OK);
148
            while (StdCan_Put(&txMsg) != StdCan_Ret_OK);
164
        break;
149
        break;
165
       
150
       
166
        case CAN_MODULE_CMD_KS0108_LCD_DRAWRECT:
151
        case CAN_MODULE_CMD_KS0108_LCD_DRAWRECT:
167
          if ((0x40&rxMsg->Data[0])>>6)
152
          if ((0x40&rxMsg->Data[0])>>6)