diff --git a/lib/sdk11/components/libraries/bootloader_dfu/dfu_transport_ble.c b/lib/sdk11/components/libraries/bootloader_dfu/dfu_transport_ble.c index 43a26e7..0444ef8 100644 --- a/lib/sdk11/components/libraries/bootloader_dfu/dfu_transport_ble.c +++ b/lib/sdk11/components/libraries/bootloader_dfu/dfu_transport_ble.c @@ -115,7 +115,6 @@ static ble_gap_id_key_t const * m_gap_ids[1]; // Adafruit static uint8_t _adv_handle = BLE_GAP_ADV_SET_HANDLE_NOT_SET; -extern void blinky_fast_set(bool isFast); /**@brief Function updating Service Changed CCCD and indicate a service change to peer. * @@ -590,7 +589,7 @@ static void on_dfu_evt(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt) break; case BLE_DFU_PACKET_WRITE: - blinky_fast_set(true); + led_blink_fast(true); on_dfu_pkt_write(p_dfu, p_evt); break; @@ -747,7 +746,7 @@ static void on_ble_evt(ble_evt_t * p_ble_evt) m_direct_adv_cnt = APP_DIRECTED_ADV_TIMEOUT; - blinky_fast_set(false); + led_blink_fast(false); err_code = sd_ble_gatts_sys_attr_get(m_conn_handle, sys_attr, diff --git a/lib/sdk11/components/libraries/bootloader_dfu/dfu_transport_serial.c b/lib/sdk11/components/libraries/bootloader_dfu/dfu_transport_serial.c index db227e6..1d6beee 100644 --- a/lib/sdk11/components/libraries/bootloader_dfu/dfu_transport_serial.c +++ b/lib/sdk11/components/libraries/bootloader_dfu/dfu_transport_serial.c @@ -19,6 +19,7 @@ #include "hci_transport.h" #include "app_timer.h" #include "app_scheduler.h" +#include "boards/boards.h" #define MAX_BUFFERS 4u /**< Maximum number of buffers that can be received queued without being consumed. */ @@ -208,7 +209,6 @@ static void process_dfu_packet(void * p_event_data, uint16_t event_size) packet = &m_data_queue.data_packet[index]; if (INVALID_PACKET != packet->packet_type) { - extern void blinky_fast_set(bool isFast); switch (DATA_QUEUE_ELEMENT_GET_PTYPE(index)) { case DATA_PACKET: @@ -227,14 +227,14 @@ static void process_dfu_packet(void * p_event_data, uint16_t event_size) retval = dfu_init_pkt_complete(); APP_ERROR_CHECK(retval); - blinky_fast_set(true); + led_blink_fast(true); break; case STOP_DATA_PACKET: (void)dfu_image_validate(); (void)dfu_image_activate(); - blinky_fast_set(false); + led_blink_fast(false); // Break the loop by returning. return; diff --git a/src/boards/boards.h b/src/boards/boards.h index f25305e..0c6560a 100644 --- a/src/boards/boards.h +++ b/src/boards/boards.h @@ -49,6 +49,8 @@ static inline void led_off(uint32_t pin) led_control(pin, false); } +void led_blink_fast(bool enable); + //--------------------------------------------------------------------+ // BUTTONS //--------------------------------------------------------------------+ diff --git a/src/main.c b/src/main.c index 69ac105..ab0c897 100644 --- a/src/main.c +++ b/src/main.c @@ -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); } diff --git a/src/usb/uf2/ghostfat.c b/src/usb/uf2/ghostfat.c index a468ab4..3256b09 100644 --- a/src/usb/uf2/ghostfat.c +++ b/src/usb/uf2/ghostfat.c @@ -2,6 +2,8 @@ #include "uf2.h" #include "nrf_nvmc.h" #include + +#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);