summaryrefslogtreecommitdiff
path: root/lightctrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'lightctrl.c')
-rw-r--r--lightctrl.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/lightctrl.c b/lightctrl.c
index 79fdeee..cc9a686 100644
--- a/lightctrl.c
+++ b/lightctrl.c
@@ -89,14 +89,35 @@ int main(void)
ctr = 0;
break;
case 512:
- dali_send(0xffa0);
- if (dali_rx_avail) {
- uart_puts("ll ");
- uart_puthex(dali_rx);
+ case 516:
+ case 520:
+ case 524:
+ case 528:
+ case 532:
+ case 536:
+ case 540:
+ if (dali_map[(ctr >> 2) & 7]) {
+ uint8_t buffer[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+ uint8_t base = (ctr << 1) & 070, map = dali_map[(ctr >> 2) & 7];
+
+ uart_puts("ll");
+ uart_puthex(base);
+ uart_puts("> ");
+
+ for (int i = 0; i < 8; i++)
+ if (map & (1 << i)) {
+ dali_send(0x1a0 | ((base + i) << 9));
+ if (dali_rx_avail) {
+ buffer[i] = dali_rx;
+ uart_puthex(dali_rx);
+ uart_puts(" ");
+ } else
+ uart_puts("EE ");
+ } else
+ uart_puts("-- ");
uart_puts("\n");
- can_send(0xe608047f, 1, (uint8_t *)&dali_rx);
- } else
- uart_puts("ll noans\n");
+ can_send(0xe6080400 + base, 8, buffer);
+ }
break;
case 1024:
can_send(0xe7000000, 8, (uint8_t *)&dalistat);