avr/devices/all: started integrating code from t03.

This commit is contained in:
Martin Preuss
2025-05-08 17:14:33 +02:00
parent cc7ef0cf30
commit 64e2cf5d25
19 changed files with 1544 additions and 100 deletions

View File

@@ -63,3 +63,25 @@ systemSetSpeed:
; @end
; ---------------------------------------------------------------------------
; @routine systemSleep
;
systemSleep:
; only modify SE, SM1 and SM0
cli
in r16, MCUCR
ldi r17, (1<<SE) | (1<<SM1) | (1<<SM0)
neg r17
and r16, r17
ori r16, (1<<SE) ; sleep mode "idle", enable
out MCUCR, r16
sei ; make sure interrupts really are enabled
sleep ; sleep, wait for interrupt
ret
; @end