Rev 1929 | Rev 2013 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1929 | Rev 1930 | ||
|---|---|---|---|
| Line 1036... | Line 1036... | ||
| 1036 | */ |
1036 | */ |
| 1037 | int8_t expandNexa2(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto) { |
1037 | int8_t expandNexa2(uint16_t *buf, uint8_t *len, Ir_Protocol_Data_t *proto) { |
| 1038 | buf[0] = IR_NEXA2_HIGH; |
1038 | buf[0] = IR_NEXA2_HIGH; |
| 1039 | buf[1] = IR_NEXA2_START2; |
1039 | buf[1] = IR_NEXA2_START2; |
| 1040 | 1040 | ||
| 1041 |
|
1041 | uint64_t tempshift = proto->data; |
| 1042 | *len = 131; |
- | |
| 1043 | 1042 | ||
| - | 1043 | /* No dimming */ |
|
| - | 1044 | *len = 131; |
|
| - | 1045 | uint8_t dimming = 0; |
|
| - | 1046 | ||
| 1044 |
|
1047 | /* If most significant bit i set, then dimming should be sent */ |
| - | 1048 | if (tempshift&(1<<64)) |
|
| - | 1049 | { |
|
| - | 1050 | /* Dimming */ |
|
| - | 1051 | *len = 147; |
|
| - | 1052 | dimming=1; |
|
| - | 1053 | } |
|
| 1045 | 1054 | ||
| 1046 | uint64_t tempshift = proto->data; |
- | |
| 1047 | for (uint8_t i = 2; i < 131; i+=4) |
1055 | for (uint8_t i = 2; i < 131; i+=4) |
| 1048 | { |
1056 | { |
| 1049 | buf[i] = IR_NEXA2_HIGH; |
1057 | buf[i] = IR_NEXA2_HIGH; |
| 1050 | buf[i+2] = IR_NEXA2_HIGH; |
1058 | buf[i+2] = IR_NEXA2_HIGH; |
| 1051 | if (tempshift&1) { |
1059 | if (tempshift&1) { |
| 1052 | buf[i+1] = IR_NEXA2_LOW_ONE; |
1060 | buf[i+1] = IR_NEXA2_LOW_ONE; |
| 1053 | buf[i+3] = IR_NEXA2_LOW_ZERO; |
1061 | buf[i+3] = IR_NEXA2_LOW_ZERO; |
| 1054 | } else { |
1062 | } else { |
| 1055 | buf[i+1] = IR_NEXA2_LOW_ZERO; |
1063 | buf[i+1] = IR_NEXA2_LOW_ZERO; |
| 1056 | buf[i+3] = IR_NEXA2_LOW_ONE; |
1064 | buf[i+3] = IR_NEXA2_LOW_ONE; |
| 1057 | } |
1065 | } |
| 1058 | tempshift = tempshift>>1; |
1066 | tempshift = tempshift>>1; |
| - | 1067 | } |
|
| - | 1068 | ||
| - | 1069 | if (dimming) |
|
| - | 1070 | { |
|
| - | 1071 | //TODO: find which bit to change, also find if it should be long or short |
|
| - | 1072 | //buf[xyz] = IR_NEXA2_LOW_xyz; |
|
| 1059 | } |
1073 | } |
| 1060 | 1074 | ||
| 1061 | proto->modfreq=IR_NEXA2_F_MOD; |
1075 | proto->modfreq=IR_NEXA2_F_MOD; |
| 1062 | proto->timeout=IR_NEXA2_START1/1000; |
1076 | proto->timeout=IR_NEXA2_START1/1000; |
| 1063 | proto->repeats=IR_NEXA2_REPS; |
1077 | proto->repeats=IR_NEXA2_REPS; |