rename led blink fast name
This commit is contained in:
parent
94e23a928c
commit
4f48b8b51a
@ -589,7 +589,7 @@ static void on_dfu_evt(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case BLE_DFU_PACKET_WRITE:
|
case BLE_DFU_PACKET_WRITE:
|
||||||
led_blink_fast(true);
|
led_red_blink_fast(true);
|
||||||
on_dfu_pkt_write(p_dfu, p_evt);
|
on_dfu_pkt_write(p_dfu, p_evt);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -750,7 +750,7 @@ static void on_ble_evt(ble_evt_t * p_ble_evt)
|
|||||||
|
|
||||||
m_direct_adv_cnt = APP_DIRECTED_ADV_TIMEOUT;
|
m_direct_adv_cnt = APP_DIRECTED_ADV_TIMEOUT;
|
||||||
|
|
||||||
led_blink_fast(false);
|
led_red_blink_fast(false);
|
||||||
|
|
||||||
err_code = sd_ble_gatts_sys_attr_get(m_conn_handle,
|
err_code = sd_ble_gatts_sys_attr_get(m_conn_handle,
|
||||||
sys_attr,
|
sys_attr,
|
||||||
|
@ -227,14 +227,14 @@ static void process_dfu_packet(void * p_event_data, uint16_t event_size)
|
|||||||
retval = dfu_init_pkt_complete();
|
retval = dfu_init_pkt_complete();
|
||||||
APP_ERROR_CHECK(retval);
|
APP_ERROR_CHECK(retval);
|
||||||
|
|
||||||
led_blink_fast(true);
|
led_red_blink_fast(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STOP_DATA_PACKET:
|
case STOP_DATA_PACKET:
|
||||||
(void)dfu_image_validate();
|
(void)dfu_image_validate();
|
||||||
(void)dfu_image_activate();
|
(void)dfu_image_activate();
|
||||||
|
|
||||||
led_blink_fast(false);
|
led_red_blink_fast(false);
|
||||||
|
|
||||||
// Break the loop by returning.
|
// Break the loop by returning.
|
||||||
return;
|
return;
|
||||||
|
@ -81,6 +81,11 @@ void board_init(void)
|
|||||||
// use PMW0 for LED RED
|
// use PMW0 for LED RED
|
||||||
led_pwm_init(LED_RED);
|
led_pwm_init(LED_RED);
|
||||||
|
|
||||||
|
// use neopixel for use enumeration
|
||||||
|
#ifdef LED_NEOPIXEL
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// Init scheduler
|
// Init scheduler
|
||||||
APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE);
|
APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE);
|
||||||
|
|
||||||
@ -170,7 +175,7 @@ void led_pwm_enable(uint32_t led_pin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void led_blink_fast(bool enable)
|
void led_red_blink_fast(bool enable)
|
||||||
{
|
{
|
||||||
if ( enable )
|
if ( enable )
|
||||||
{
|
{
|
||||||
|
@ -34,8 +34,6 @@
|
|||||||
#define LED_RED LED_1
|
#define LED_RED LED_1
|
||||||
#define LED_BLUE LED_2
|
#define LED_BLUE LED_2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Helper function
|
// Helper function
|
||||||
#define memclr(buffer, size) memset(buffer, 0, size)
|
#define memclr(buffer, size) memset(buffer, 0, size)
|
||||||
#define varclr(_var) memclr(_var, sizeof(*(_var)))
|
#define varclr(_var) memclr(_var, sizeof(*(_var)))
|
||||||
@ -71,7 +69,7 @@ void led_pwm_teardown(uint32_t led_pin);
|
|||||||
void led_pwm_disable(uint32_t led_pin);
|
void led_pwm_disable(uint32_t led_pin);
|
||||||
void led_pwm_enable(uint32_t led_pin);
|
void led_pwm_enable(uint32_t led_pin);
|
||||||
|
|
||||||
void led_blink_fast(bool enable);
|
void led_red_blink_fast(bool enable);
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// BUTTONS
|
// BUTTONS
|
||||||
|
@ -43,8 +43,9 @@
|
|||||||
/* LED
|
/* LED
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
#define LEDS_NUMBER 2
|
#define LEDS_NUMBER 2
|
||||||
#define LED_1 _PINNUM(1, 2) // P1.02
|
#define LED_1 _PINNUM(1, 15)
|
||||||
#define LED_2 _PINNUM(1, 10) // P1.10
|
#define LED_2 _PINNUM(1, 10)
|
||||||
|
#define LED_NEOPIXEL 16
|
||||||
#define LED_STATE_ON 1
|
#define LED_STATE_ON 1
|
||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
|
@ -170,12 +170,12 @@ int main(void)
|
|||||||
// When updating SoftDevice, bootloader will reset before swapping SD
|
// When updating SoftDevice, bootloader will reset before swapping SD
|
||||||
if (bootloader_dfu_sd_in_progress())
|
if (bootloader_dfu_sd_in_progress())
|
||||||
{
|
{
|
||||||
led_blink_fast(true);
|
led_red_blink_fast(true);
|
||||||
|
|
||||||
APP_ERROR_CHECK( bootloader_dfu_sd_update_continue() );
|
APP_ERROR_CHECK( bootloader_dfu_sd_update_continue() );
|
||||||
APP_ERROR_CHECK( bootloader_dfu_sd_update_finalize() );
|
APP_ERROR_CHECK( bootloader_dfu_sd_update_finalize() );
|
||||||
|
|
||||||
led_blink_fast(false);
|
led_red_blink_fast(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*------------- Determine DFU mode (Serial, OTA, FRESET or normal) -------------*/
|
/*------------- Determine DFU mode (Serial, OTA, FRESET or normal) -------------*/
|
||||||
@ -268,7 +268,7 @@ int main(void)
|
|||||||
void adafruit_factory_reset(void)
|
void adafruit_factory_reset(void)
|
||||||
{
|
{
|
||||||
// Blink fast RED and turn on BLUE when erasing
|
// Blink fast RED and turn on BLUE when erasing
|
||||||
led_blink_fast(true);
|
led_red_blink_fast(true);
|
||||||
led_on(LED_BLUE);
|
led_on(LED_BLUE);
|
||||||
|
|
||||||
// clear all App Data if any
|
// clear all App Data if any
|
||||||
@ -281,7 +281,7 @@ void adafruit_factory_reset(void)
|
|||||||
nrf_nvmc_page_erase(DFU_BANK_0_REGION_START);
|
nrf_nvmc_page_erase(DFU_BANK_0_REGION_START);
|
||||||
|
|
||||||
// back to normal
|
// back to normal
|
||||||
led_blink_fast(false);
|
led_red_blink_fast(false);
|
||||||
led_off(LED_BLUE);
|
led_off(LED_BLUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ void read_block(uint32_t block_no, uint8_t *data) {
|
|||||||
/** uf2 upgrade complete -> inform bootloader to update setting and reset */
|
/** uf2 upgrade complete -> inform bootloader to update setting and reset */
|
||||||
static void uf2_write_complete(uint32_t numBlocks)
|
static void uf2_write_complete(uint32_t numBlocks)
|
||||||
{
|
{
|
||||||
led_blink_fast(false);
|
led_red_blink_fast(false);
|
||||||
|
|
||||||
dfu_update_status_t update_status;
|
dfu_update_status_t update_status;
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ int write_block(uint32_t block_no, uint8_t *data, bool quiet/*, WriteState *stat
|
|||||||
static bool first_write = true;
|
static bool first_write = true;
|
||||||
if ( first_write ) {
|
if ( first_write ) {
|
||||||
first_write = false;
|
first_write = false;
|
||||||
led_blink_fast(true);
|
led_red_blink_fast(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
flash_nrf5x_write(bl->targetAddr, bl->data, bl->payloadSize, true);
|
flash_nrf5x_write(bl->targetAddr, bl->data, bl->payloadSize, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user