![]() |
CHGame 0.3.0
Libraries for the CHGame handheld
|
The Arduino EEPROM API over the option-byte area, for the CH32V003. More...
Classes | |
| class | EEPROMClass |
| 26 bytes of emulated EEPROM in the option-byte area, worked on in a RAM copy and written by commit() (see EEPROM). More... | |
Variables | |
| EEPROMClass | EEPROM |
| The emulated EEPROM. | |
The Arduino EEPROM API over the option-byte area, for the CH32V003.
On the CHGame board (CH32X035) it does not save: commit() writes nothing and returns false.
What the library does on the chip it was written for, the CH32V003:
Data0 and Data1; bytes 2-25 are kept as half-words (each value with its inverse) at 0x1FFFF810-0x1FFFF83F, after the 16 bytes of the option-byte block (OB_BASE, 0x1FFFF800).[] work on that buffer. Nothing reaches flash until commit() (or end()).RDPR), user (USER) and write protection (WRPR0-3) words it copied just before, then Data0, Data1 and every byte that is not 0xFF. It does not check what it wrote.On the CH32X035 that commit() is switched off, and a sketch that includes this header gets a compiler message saying so. The chip's option-byte block is the 16 bytes alone, and WCH's CH32X035 library programs it only as one fast-programmed page, never a half-word at a time as above. A write that did not take after the erase would leave the chip read-protected (removing that with the factory ISP erases the whole flash, bootloader included) or with its user options changed (on this board they keep PB7, SELECT, from being the reset pin). So on this chip begin() reads Data0 and Data1 and sets bytes 2-25 to 0xFF, everything works on the RAM copy as usual, and commit() returns false without writing. Nothing survives a reset.
|
extern |
The emulated EEPROM.
Call EEPROM.begin() first.