more clean up

This commit is contained in:
hathach
2018-08-08 00:41:41 +07:00
parent 108e47438e
commit 6f40f02537
5 changed files with 15 additions and 17 deletions

View File

@ -49,6 +49,8 @@ static inline void led_off(uint32_t pin)
led_control(pin, false);
}
void led_blink_fast(bool enable);
//--------------------------------------------------------------------+
// BUTTONS
//--------------------------------------------------------------------+

View File

@ -174,9 +174,9 @@ void SysTick_Handler(void)
blinky_handler();
}
void blinky_fast_set(bool isFast)
void led_blink_fast(bool enable)
{
_fast_blink = isFast;
_fast_blink = enable;
}
void board_init(void)
@ -417,7 +417,7 @@ void freset_erase_and_wait(pstorage_handle_t* hdl, uint32_t addr, uint32_t size)
void adafruit_factory_reset(void)
{
// Blink fast RED and turn on BLUE when erasing
blinky_fast_set(true);
led_blink_fast(true);
led_on(LED_BLUE);
static pstorage_handle_t freset_handle = { .block_id = APPDATA_ADDR_START } ;
@ -432,7 +432,7 @@ void adafruit_factory_reset(void)
freset_erase_and_wait(&freset_handle, DFU_BANK_0_REGION_START, CODE_PAGE_SIZE);
// back to normal
blinky_fast_set(false);
led_blink_fast(false);
led_off(LED_BLUE);
}

View File

@ -2,6 +2,8 @@
#include "uf2.h"
#include "nrf_nvmc.h"
#include <string.h>
#include "boards/boards.h"
#include "tusb.h"
#include "bootloader_settings.h"
@ -130,11 +132,6 @@ static WriteState* state = &_wr_state;
volatile bool _is_flashing = false;
static pstorage_handle_t _fat_psh = { .module_id = 0, .block_id = USER_FLASH_END } ;
// from main.c to signal writing uf2 is on the way
extern void blinky_fast_set(bool isFast);
static uint32_t get_flash_size(void)
{
static uint32_t flash_sz = 0;
@ -258,7 +255,7 @@ void read_block(uint32_t block_no, uint8_t *data) {
/** inform bootloader to update setting and reset */
static void uf2_write_complete(void)
{
blinky_fast_set(false);
led_blink_fast(false);
dfu_update_status_t update_status;
@ -307,7 +304,7 @@ void flushFlash() {
pstorage_module_param_t fat_psp = { .cb = fat_pstorage_cb};
pstorage_register(&fat_psp, &_fat_psh);
blinky_fast_set(true);
led_blink_fast(true);
}
NRF_LOG_DEBUG("Flush at %x", flashAddr);