@@ -198,7 +198,6 @@ static bool copy_block(uint32_t src_address, uint32_t dest_address) {
198198
199199void spi_flash_init (void ) {
200200 if (!spi_flash_is_initialised ) {
201-
202201 struct spi_config config_spi_master ;
203202 spi_get_config_defaults (& config_spi_master );
204203 config_spi_master .mux_setting = SPI_FLASH_MUX_SETTING ;
@@ -218,6 +217,12 @@ void spi_flash_init(void) {
218217 port_pin_set_config (SPI_FLASH_CS , & pin_conf );
219218 flash_disable ();
220219
220+ // Activity LED for flash writes.
221+ #ifdef MICROPY_HW_LED_MSC
222+ port_pin_set_config (MICROPY_HW_LED_MSC , & pin_conf );
223+ port_pin_set_output_level (MICROPY_HW_LED_MSC , false);
224+ #endif
225+
221226 uint8_t jedec_id_request [4 ] = {CMD_READ_JEDEC_ID , 0x00 , 0x00 , 0x00 };
222227 uint8_t response [4 ] = {0x00 , 0x00 , 0x00 , 0x00 };
223228 flash_enable ();
@@ -377,13 +382,19 @@ static void spi_flash_flush_keep_cache(bool keep_cache) {
377382 if (current_sector == NO_SECTOR_LOADED ) {
378383 return ;
379384 }
385+ #ifdef MICROPY_HW_LED_MSC
386+ port_pin_set_output_level (MICROPY_HW_LED_MSC , true);
387+ #endif
380388 // If we've cached to the flash itself flush from there.
381389 if (ram_cache == NULL ) {
382390 flush_scratch_flash ();
383391 } else {
384392 flush_ram_cache (keep_cache );
385393 }
386394 current_sector = NO_SECTOR_LOADED ;
395+ #ifdef MICROPY_HW_LED_MSC
396+ port_pin_set_output_level (MICROPY_HW_LED_MSC , false);
397+ #endif
387398}
388399
389400// External flash function used. If called externally we assume we won't need
0 commit comments