@@ -47,20 +47,29 @@ bool hwInit(void)
4747
4848void hwReadConfigBlock (void *buf, void *addr, size_t length)
4949{
50+ // MY_SERIALDEVICE.println(F("START hwReadConfigBlock"));
5051 uint8_t *dst = static_cast <uint8_t *>(buf);
5152 int offs = reinterpret_cast <int >(addr);
53+
54+ eeprom_buffer_fill ();
5255 while (length-- > 0 ) {
53- *dst++ = EEPROM. read (offs++);
56+ *dst++ = eeprom_buffered_read_byte (offs++);
5457 }
58+ // MY_SERIALDEVICE.println(F("END hwReadConfigBlock"));
5559}
5660
5761void hwWriteConfigBlock (void *buf, void *addr, size_t length)
5862{
63+ // MY_SERIALDEVICE.println(F("START hwWriteConfigBlock"));
5964 uint8_t *src = static_cast <uint8_t *>(buf);
6065 int offs = reinterpret_cast <int >(addr);
66+
6167 while (length-- > 0 ) {
62- EEPROM. write (offs++, *src++);
68+ eeprom_buffered_write_byte (offs++, *src++);
6369 }
70+ // MY_SERIALDEVICE.println(F("START FLUSH"));
71+ eeprom_buffer_flush ();
72+ // MY_SERIALDEVICE.println(F("END hwWriteConfigBlock"));
6473}
6574
6675uint8_t hwReadConfig (const int addr)
@@ -110,7 +119,11 @@ int8_t hwSleep(const uint8_t interrupt1, const uint8_t mode1, const uint8_t inte
110119
111120bool hwUniqueID (unique_id_t *uniqueID)
112121{
113- (void )memcpy ((uint8_t *)uniqueID, (uint32_t *)0x1FFFF7E0 , 16 ); // FlashID + ChipID
122+ // Fill ID with FF
123+ (void )memset ((uint8_t *)uniqueID, 0xFF , 16 );
124+ // Read device ID
125+ (void )memcpy ((uint8_t *)uniqueID, (uint32_t *)UID_BASE, 12 );
126+
114127 return true ;
115128}
116129
0 commit comments