avr/module/flash: unified flash code for 1p/4p devices.

AtTiny 841 erases 4 pages at once, others only erase one.
Fixed a bug: only send ONE flash response to FLASH_START!!!
This commit is contained in:
Martin Preuss
2025-05-04 03:32:53 +02:00
parent b632a10fff
commit e25b0ad69d
6 changed files with 385 additions and 619 deletions

View File

@@ -68,13 +68,25 @@ flashWaitForMulti100ms_loop:
flashWaitFor100ms:
ldi r24, 100
flashWaitFor100ms_loop:
rjmp flashWaitForMillisecs
; ---------------------------------------------------------------------------
; @routine flashWaitForMillisecs
; wait for multiples of 100 milliseconds.
;
; @param R24 time to wait in milliseconds
; @clobbers R24 (R22)
flashWaitForMillisecs:
push r24
rcall flashWaitFor1ms ; (R22, R24)
pop r24
dec r24
brne flashWaitFor100ms_loop
brne flashWaitForMillisecs
ret
; @end