1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-09-06 23:28:48 +10:00
collapseos/blk/163
Virgil Dupras eafcb0c440 avrpgm: add EEPROM support
also, verify all 3 first bytes of SPI commands. I'm not sure why
I wasn't doing that, probably because I was getting a lot of AVR
err and thought that only 2 bytes of the cmd were echoed. But now,
with a reliable SPI setup, verifying 3 bytes seems to work.
2020-10-05 19:36:49 -04:00

7 lines
238 B
Plaintext

: aspe@ ( addr -- byte, read from EEPROM )
0 SWAP 256 /MOD ( 0 lsb msb ) SWAP
0xa0 ( 0 msb lsb 0xa0 ) _cmd ;
: aspe! ( byte addr --, write to EEPROM )
256 /MOD ( b lsb msb ) SWAP
0xc0 ( b msb lsb 0xc0 ) _cmd DROP asprdy ;