From ee5a2e490a369134c41eeb8f8cfc1c229f6742bd Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 25 Oct 2018 17:49:53 +0700 Subject: [PATCH] add flash writing indicator using LED_BUILTIN --- cores/nRF5/flash/flash_cache.c | 8 +++++++- .../examples/External_ReadWrite/External_ReadWrite.ino | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cores/nRF5/flash/flash_cache.c b/cores/nRF5/flash/flash_cache.c index 9fce03f0..c1870195 100644 --- a/cores/nRF5/flash/flash_cache.c +++ b/cores/nRF5/flash/flash_cache.c @@ -35,8 +35,9 @@ /**************************************************************************/ #include "flash_cache.h" - #include "common_func.h" +#include "variant.h" +#include "wiring_digital.h" //--------------------------------------------------------------------+ // MACRO TYPEDEF CONSTANT ENUM DECLARATION @@ -101,8 +102,13 @@ void flash_cache_flush (flash_cache_t* fc) // skip erase & program if verify() exists, and memory matches if ( !(fc->verify && fc->verify(fc->cache_addr, fc->cache_buf, FLASH_CACHE_SIZE)) ) { + // indicator + ledOn(LED_BUILTIN); + fc->erase(fc->cache_addr); fc->program(fc->cache_addr, fc->cache_buf, FLASH_CACHE_SIZE); + + ledOff(LED_BUILTIN); } fc->cache_addr = FLASH_CACHE_INVALID_ADDR; diff --git a/libraries/FileSystem/examples/External_ReadWrite/External_ReadWrite.ino b/libraries/FileSystem/examples/External_ReadWrite/External_ReadWrite.ino index 2980e9f2..95ae79b2 100644 --- a/libraries/FileSystem/examples/External_ReadWrite/External_ReadWrite.ino +++ b/libraries/FileSystem/examples/External_ReadWrite/External_ReadWrite.ino @@ -75,6 +75,5 @@ void setup() // the loop function runs over and over again forever void loop() { - digitalToggle(LED_RED); - delay(1000); + // nothing to do }