SPI flash support, with xiao nrf52 and portenta-h7

This commit is contained in:
cpq committed 2026-12-03 11:56:57 +00:00
1 parent 57e30ab2e9
commit f02ea9859e
17 files changed
+442 -17

No files matched your search

@@ -25,6 +25,13 @@ bool mg_random(void *buf, size_t len) {
return true;
}
// The on-board P25Q16H 2 MB flash for littlefs, see MG_LFS_FLASH in
// mongoose_config.h. Mongoose's SPI flash API drives it over hal.h's SPI.
// Early boards (V1.1) have the chip not fitted. Then init fails and the
// filesystem is not available
static struct mg_spi s_spi = {NULL, hal_spi_begin, hal_spi_end, hal_spi_txn};
MG_SPI_FLASH(mg_flash_spi, &s_spi);
int main(void) {
hal_system_init();
hal_rng_init();
@@ -35,6 +42,7 @@ int main(void) {
hal_gpio_output(LED_GREEN);
hal_gpio_output(LED_BLUE);
int imu = hal_imu_init(); // For the dashboard's real-time graph
hal_spi_init(); // On-board flash, see MG_SPI_FLASH() above
struct mg_mgr mgr;
mg_mgr_init(&mgr); // Also starts the USB driver, see mongoose_config.h