From cc32704b228e943b49c2aed17fb60508404d5359 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 20 Jun 2012 22:45:10 +0200 Subject: dali: track bus addrs in use --- lightctrl.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'lightctrl.c') 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); -- cgit v1.2.1