1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/mtd: fix mtd_write_sector

Parameter `num` of `mtd_write_page_raw` is the number of bytes to be written, which is the number of sectors to be written`count` multiplied by the pages per sector `mtd->pages_per_sector` and the page size `mtd->page_size`.
This commit is contained in:
Gunar Schorcht 2024-01-07 16:46:58 +01:00
parent 866f2a00c0
commit caa31ecbdc

View File

@ -395,7 +395,8 @@ int mtd_write_sector(mtd_dev_t *mtd, const void *data, uint32_t sector,
}
uint32_t page = sector * mtd->pages_per_sector;
return mtd_write_page_raw(mtd, data, page, 0, page * mtd->page_size);
return mtd_write_page_raw(mtd, data, page, 0,
count * mtd->pages_per_sector * mtd->page_size);
}
int mtd_power(mtd_dev_t *mtd, enum mtd_power_state power)