Subversion Repositories HomeAutomation

Rev

Rev 584 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 584 Rev 810
Line 42... Line 42...
42
//Working on implementing all of these...
42
//Working on implementing all of these...
43
 
43
 
44
#define RGBLED_CMD_STATUS           0x00    /* Get status */
44
#define RGBLED_CMD_STATUS           0x00    /* Get status */
45
#define RGBLED_CMD_SETRGB           0x01    /* Set RGB Triplet */
45
#define RGBLED_CMD_SETRGB           0x01    /* Set RGB Triplet */
46
#define RGBLED_CMD_CHANGERGB        0x02    /* Change RGB +/- */
46
#define RGBLED_CMD_CHANGERGB        0x02    /* Change RGB +/- */
47
#define RGBLED_CMD_SETPROGRAM       0x03  /* Set program */
47
#define RGBLED_CMD_SETPROGRAM       0x03    /* Set program */
48
#define RGBLED_CMD_SETFADESPEED     0x04  /* Set fadespeed */
48
#define RGBLED_CMD_SETFADESPEED     0x04    /* Set fadespeed */
49
#define RGBLED_CMD_SETDIMSPEED      0x05  /* Set dimspeed */
49
#define RGBLED_CMD_SETDIMSPEED      0x05    /* Set dimspeed */
50
#define RGBLED_CMD_SETINTENS        0x10  /* Set intensity */
50
#define RGBLED_CMD_SETINTENS        0x10    /* Set intensity */
51
 
51
 
52
#define APP_TYPE    CAN_APPTYPES_RGBLED
52
#define APP_TYPE    CAN_APPTYPES_RGBLED
53
#define APP_VERSION 0x0001
53
#define APP_VERSION 0x0001
54
 
54
 
55
#define GROUP_ID    0x01L // FIXME
55
#define GROUP_ID    0x01L // FIXME
Line 282... Line 282...
282
                        }
282
                        }
283
                        destColor.Intens = rxMsg.Data.bytes[2];
283
                        destColor.Intens = rxMsg.Data.bytes[2];
284
                        if (rxMsg.Data.bytes[3] != 0){
284
                        if (rxMsg.Data.bytes[3] != 0){
285
                            dimSpeed = rxMsg.Data.bytes[3];
285
                            dimSpeed = rxMsg.Data.bytes[3];
286
                        }
286
                        }
287
                        currProgram = rxMsg.Data.bytes[1];
-
 
288
                        temp_adress = pgm_read_word(&programs[currProgram-1]);
-
 
289
                    } else if( rxMsg.Data.bytes[0] == RGBLED_CMD_SETRGB) {
287
                    } else if( rxMsg.Data.bytes[0] == RGBLED_CMD_SETRGB) {
290
                        /* Set RGB-triplet! */
288
                        /* Set RGB-triplet! */
291
                        reformatRGB(rxMsg.Data.bytes[2],rxMsg.Data.bytes[3],rxMsg.Data.bytes[4],0);
289
                        reformatRGB(rxMsg.Data.bytes[2],rxMsg.Data.bytes[3],rxMsg.Data.bytes[4],0);
292
                        if (rxMsg.Data.bytes[5] != 0){
290
                        if (rxMsg.Data.bytes[5] != 0){
293
                            destColor.Intens = rxMsg.Data.bytes[5];
291
                            destColor.Intens = rxMsg.Data.bytes[5];
Line 328... Line 326...
328
    tempcontainer = currColor.R * currColor.Intens / 0xff;  //I really want to skip this, don't know how yet though.
326
    tempcontainer = currColor.R * currColor.Intens / 0xff;  //I really want to skip this, don't know how yet though.
329
    OCR1A = tempcontainer;
327
    OCR1A = tempcontainer;
330
    OCR0A = currColor.G * currColor.Intens / 0xff;
328
    OCR0A = currColor.G * currColor.Intens / 0xff;
331
    OCR0B = currColor.B * currColor.Intens / 0xff;
329
    OCR0B = currColor.B * currColor.Intens / 0xff;
332
   
330
   
333
    //Bara för debugcrap
331
    //Just for debug
334
    Can_Message_t txMsg;
332
    Can_Message_t txMsg;
335
    txMsg.Id = 0x55;
333
    txMsg.Id = 0x55;
336
    txMsg.RemoteFlag = 0;
334
    txMsg.RemoteFlag = 0;
337
    txMsg.ExtendedFlag = 1;
335
    txMsg.ExtendedFlag = 1;
338
    txMsg.DataLength = 4;
336
    txMsg.DataLength = 4;