add flash writing indicator using LED_BUILTIN

This commit is contained in:
hathach committed 2018-10-25 17:49:53 +07:00
1 parent 27efec949a
commit ee5a2e490a
2 files changed
+8 -3

No files matched your search

+7 -1
View File
@@ -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;
@@ -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
}