summaryrefslogtreecommitdiff
path: root/lightctrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'lightctrl.c')
-rw-r--r--lightctrl.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/lightctrl.c b/lightctrl.c
index 404ca33..5c70c90 100644
--- a/lightctrl.c
+++ b/lightctrl.c
@@ -67,7 +67,8 @@ int main(void)
dali_search();
- uint8_t ctr = 0;
+ uint16_t ctr = 0;
+
while (1) {
if (canint) {
canint = false;
@@ -82,26 +83,31 @@ int main(void)
do_tick();
ctr++;
- if (ctr % 64 == 0) {
+ switch (ctr) {
+ case 2048:
+ ctr = 0;
+ break;
+ case 512:
dali_send(0xffa0);
if (dali_rx_avail) {
uart_puts("ll ");
uart_puthex(dali_rx);
uart_puts("\n");
- can_send(0xaa800000, 1, (uint8_t *)&dali_rx);
+ can_send(0xe608047f, 1, (uint8_t *)&dali_rx);
} else
uart_puts("ll noans\n");
- }
+ break;
+ case 1024:
+ can_send(0xe7000000, 8, (uint8_t *)&dalistat);
- if (ctr == 255) {
uart_puts("dali stats: ");
- uart_puthex16(dalistat_rxok);
+ uart_puthex16(dalistat.rxok);
uart_puts(" ok ");
- uart_puthex16(dalistat_falsestart);
+ uart_puthex16(dalistat.falsestart);
uart_puts(" f-start ");
- uart_puthex16(dalistat_noise);
+ uart_puthex16(dalistat.noise);
uart_puts(" noise ");
- uart_puthex16(dalistat_manchester);
+ uart_puthex16(dalistat.manchester);
uart_puts(" mch-err\n");
}
}