.cseg main: ; setup stack .ifdef SPH ; if SPH is defined ldi r16, High(RAMEND) out SPH, r16 ; init MSB stack pointer .endif ldi r16, Low(RAMEND) out SPL, r16 ; init LSB stack pointer rcall initModules rcall Utils_SetupUid rcall initialWait sei ; Enable interrupts rcall onSystemStart #ifdef MODULES_LED ldi xl, LOW(blinkPattern) ; debug: set blink pattern ldi xh, HIGH(blinkPattern) ldi zl, LOW(ledA3Flash) ldi zh, HIGH(ledA3Flash) ldi yl, LOW(ledA3Sram) ldi yh, HIGH(ledA3Sram) rcall Led_SetPattern #endif ; ldi r16, 1 ; sts twiMasterScanEnabled, r16 main_loop: rcall runModulesUntilIdle ; sbi DDRA, PORTA2 ; debug ; sbi PINA, PORTA2 ; debug (toggle) ; cbi PORTA, PORTA2 ; debug (on) ; sbi PORTA, PORTA2 ; debug (off) ; only modify SE, SM1 and SM0 in r16, MCUCR ldi r17, (1<