I plan to use a single mode for encoding all three pwmleds:
2 bits for PWMLED 0
1 bit for PWMLED 1
2 bits for PWMLED 2
};
pattern_t on1_pattern [] = {
- { 1, 0x10 },
+ { 1, 0x7 },
PATTERN_END
};
static pattern_t on2_pattern [] = {
- { 2, 0x10 },
+ { 2, 0x7 },
PATTERN_END
};
static pattern_t on3_pattern [] = {
- { 3, 0x10 },
+ { 3, 0x7 },
PATTERN_END
};
static pattern_t brake_pattern [] = {
{ 4, 0x2 },
- { 3, 0x8 },
+ { 3, 0x7 },
PATTERN_END
};
{ 2, 0x1 },
{ 0, 0x1 },
{ 2, 0x1 },
- { 0, 0x8 },
+ { 0, 0x7 },
{ 1, 0x1 },
{ 0, 0x1 },
{ 1, 0x1 },
- { 0, 0x8 },
+ { 0, 0x7 },
PATTERN_END
};
{ 3, 0x1 },
{ 0, 0x1 },
{ 3, 0x1 },
- { 0, 0x8 },
+ { 0, 0x7 },
{ 1, 0x1 },
{ 0, 0x1 },
{ 1, 0x1 },
- { 0, 0x8 },
+ { 0, 0x7 },
PATTERN_END
};
{ 4, 0x1 },
{ 0, 0x1 },
{ 4, 0x1 },
- { 0, 0x8 },
+ { 0, 0x7 },
{ 1, 0x1 },
{ 0, 0x1 },
{ 1, 0x1 },
- { 0, 0x8 },
+ { 0, 0x7 },
PATTERN_END
};
static pattern_t slow1_pattern[] = {
{ 1, 0x01 },
- { 0, 0x10 },
+ { 0, 0x7 },
+ { 0, 0x7 },
PATTERN_END
};
static pattern_t slow2_pattern[] = {
{ 2, 0x01 },
- { 0, 0x10 },
+ { 0, 0x7 },
+ { 0, 0x7 },
PATTERN_END
};
static pattern_t slow3_pattern[] = {
{ 3, 0x01 },
- { 0, 0x10 },
+ { 0, 0x7 },
+ { 0, 0x7 },
PATTERN_END
};
/* pattern.c */
typedef struct {
- unsigned char mode: 3;
- unsigned char duration: 5;
+ unsigned char mode: 5;
+ unsigned char duration: 3;
} pattern_t;
#define PATTERN_END { 0, 0 }
{ 0, 0x1 },
{ 1, 0x1 },
{ 0, 0x1 },
- { 1, 0x10 },
- { 0, 0x10 },
+ { 1, 0x7 },
+ { 0, 0x7 },
PATTERN_END
};
{ 1, 0x1 }, /* 2 */
{ 0, 0x5 },
{ 1, 0x1 }, /* 1 */
- { 0, 0xF },
+ { 0, 0x7 },
+ { 0, 0x7 },
PATTERN_END
};
{ 0, 0x1 }, /* 2 */
{ 1, 0x5 },
{ 0, 0x1 }, /* 1 */
- { 1, 0xF },
+ { 1, 0x7 },
+ { 1, 0x7 },
PATTERN_END
};