@@ -47,20 +47,29 @@ bool hwInit(void)
47
47
48
48
void hwReadConfigBlock (void *buf, void *addr, size_t length)
49
49
{
50
+ // MY_SERIALDEVICE.println(F("START hwReadConfigBlock"));
50
51
uint8_t *dst = static_cast <uint8_t *>(buf);
51
52
int offs = reinterpret_cast <int >(addr);
53
+
54
+ eeprom_buffer_fill ();
52
55
while (length-- > 0 ) {
53
- *dst++ = EEPROM. read (offs++);
56
+ *dst++ = eeprom_buffered_read_byte (offs++);
54
57
}
58
+ // MY_SERIALDEVICE.println(F("END hwReadConfigBlock"));
55
59
}
56
60
57
61
void hwWriteConfigBlock (void *buf, void *addr, size_t length)
58
62
{
63
+ // MY_SERIALDEVICE.println(F("START hwWriteConfigBlock"));
59
64
uint8_t *src = static_cast <uint8_t *>(buf);
60
65
int offs = reinterpret_cast <int >(addr);
66
+
61
67
while (length-- > 0 ) {
62
- EEPROM. write (offs++, *src++);
68
+ eeprom_buffered_write_byte (offs++, *src++);
63
69
}
70
+ // MY_SERIALDEVICE.println(F("START FLUSH"));
71
+ eeprom_buffer_flush ();
72
+ // MY_SERIALDEVICE.println(F("END hwWriteConfigBlock"));
64
73
}
65
74
66
75
uint8_t hwReadConfig (const int addr)
@@ -110,7 +119,11 @@ int8_t hwSleep(const uint8_t interrupt1, const uint8_t mode1, const uint8_t inte
110
119
111
120
bool hwUniqueID (unique_id_t *uniqueID)
112
121
{
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
+
114
127
return true ;
115
128
}
116
129
0 commit comments