diff options
Diffstat (limited to 'dali_ctl.c')
| -rw-r--r-- | dali_ctl.c | 13 | 
1 files changed, 12 insertions, 1 deletions
| @@ -16,6 +16,9 @@  static uint8_t dali_s_byte, dali_sh, dali_sm, dali_sl;  static bool dali_s_notfound; +/* [0] bit 0 => addr 0, [0] bit 1 => addr 1, etc. */ +static uint8_t dali_map[8]; +  EEMEM uint8_t dali_nextaddr = 0x02;  static uint8_t dali_assign; @@ -90,9 +93,13 @@ static void dali_search(void)  			uart_puthex(dali_sl);  			dali_send(DALI_C_QURYSHORT);  			if (dali_rx_avail) { +				uint8_t addr = 0xff; +  				if ((dali_rx & 0x81) == 0x01) { +					addr = dali_rx >> 1; +  					uart_puts(" short: "); -					uart_puthex(dali_rx >> 1); +					uart_puthex(addr);  					uart_puts("\n");  				} else {  					uart_puts(" noshort "); @@ -106,8 +113,12 @@ static void dali_search(void)  					} else  						uart_puts("progfail\n"); +					addr = dali_assign;  					dali_assign++;  				} + +				if (addr < 64) +					dali_map[addr >> 3] |= 1 << (addr & 0x7);  			} else  				uart_puts(" error\n");  			dali_send(DALI_C_WITHDRAW); | 
