esp8266/machine_rtc: Use correct arithmetic for aligning RTC mem len.
This commit is contained in:
parent
4a6c0fda78
commit
caa132a236
esp8266
|
@ -173,7 +173,7 @@ STATIC mp_obj_t pyb_rtc_memory(mp_uint_t n_args, const mp_obj_t *args) {
|
||||||
// read RTC memory
|
// read RTC memory
|
||||||
|
|
||||||
system_rtc_mem_read(MEM_USER_LEN_ADDR, &len, sizeof(len));
|
system_rtc_mem_read(MEM_USER_LEN_ADDR, &len, sizeof(len));
|
||||||
system_rtc_mem_read(MEM_USER_DATA_ADDR, rtcram, len + (4 - len % 4));
|
system_rtc_mem_read(MEM_USER_DATA_ADDR, rtcram, (len + 3) & ~3);
|
||||||
|
|
||||||
return mp_obj_new_bytes(rtcram, len);
|
return mp_obj_new_bytes(rtcram, len);
|
||||||
} else {
|
} else {
|
||||||
|
@ -195,7 +195,7 @@ STATIC mp_obj_t pyb_rtc_memory(mp_uint_t n_args, const mp_obj_t *args) {
|
||||||
rtcram[i] = ((uint8_t *)bufinfo.buf)[i];
|
rtcram[i] = ((uint8_t *)bufinfo.buf)[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
system_rtc_mem_write(MEM_USER_DATA_ADDR, rtcram, len + (4 - len % 4));
|
system_rtc_mem_write(MEM_USER_DATA_ADDR, rtcram, (len + 3) & ~3);
|
||||||
|
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue