LED 직접 제어 모듈 추가(BSP 대체)
- 전원 ON/OFF, 블루투스 스캐닝 초록 LED 적용 완료
This commit is contained in:
@@ -114,6 +114,7 @@
|
||||
#include "debug_print.h" /* 디버그 출력 매크로 (DBG_PRINTF) */
|
||||
#include "fstorage.h" /* Flash Storage 래퍼 (FDS 초기화/저장/로드) */
|
||||
#include "dr_piezo.h" /* 피에조 초음파 드라이버 */
|
||||
#include "led_control.h" /* LED 직접 제어 드라이버 (BSP 미사용) */
|
||||
|
||||
|
||||
|
||||
@@ -439,7 +440,7 @@ static void t_power_off_timeout_handler(void * p_context)
|
||||
UNUSED_PARAMETER(p_context);
|
||||
APP_ERROR_CHECK(app_timer_stop(m_power_off_delay_timer_id));
|
||||
DBG_PRINTF("[PWR] Off timeout\r\n");
|
||||
bsp_indication_set(BSP_INDICATE_USER_STATE_OFF); /* LED OFF */
|
||||
led_set_state(LED_STATE_OFF); /* LED OFF */
|
||||
power_control_handler(OFF); /* P0.8 LOW → 전원 차단 */
|
||||
}
|
||||
|
||||
@@ -798,7 +799,7 @@ static void on_adv_evt(ble_adv_evt_t ble_adv_evt)
|
||||
switch (ble_adv_evt)
|
||||
{
|
||||
case BLE_ADV_EVT_FAST:
|
||||
bsp_indication_set(BSP_INDICATE_ADVERTISING);
|
||||
led_set_state(LED_STATE_ADVERTISING);
|
||||
DBG_PRINTF("[ADV] Fast\r\n");
|
||||
break;
|
||||
case BLE_ADV_EVT_IDLE:
|
||||
@@ -1067,8 +1068,7 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
|
||||
APP_ERROR_CHECK(err_code);
|
||||
}
|
||||
|
||||
err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
|
||||
APP_ERROR_CHECK(err_code);
|
||||
led_set_state(LED_STATE_OFF); /* 연결 완료 → LED OFF */
|
||||
|
||||
break;
|
||||
|
||||
@@ -1191,7 +1191,7 @@ void bsp_event_handler(bsp_event_t event)
|
||||
if (processing == false)
|
||||
{
|
||||
DBG_PRINTF("[BSP] Power\r\n");
|
||||
bsp_indication_set(BSP_INDICATE_USER_STATE_ON);
|
||||
led_set_state(LED_STATE_POWER_OFF);
|
||||
go_device_power_off = true;
|
||||
main_timer_start();
|
||||
}
|
||||
@@ -1206,14 +1206,16 @@ void bsp_event_handler(bsp_event_t event)
|
||||
* 유틸리티 함수
|
||||
*============================================================================*/
|
||||
|
||||
/** @brief BSP 버튼/LED 초기화 (부트 Phase 5) */
|
||||
/** @brief BSP 버튼 초기화 + LED 직접 초기화 (부트 Phase 5) */
|
||||
static void buttons_leds_init(bool * p_erase_bonds)
|
||||
{
|
||||
bsp_event_t startup_event;
|
||||
|
||||
uint32_t err_code = bsp_init(BSP_INIT_LEDS | BSP_INIT_BUTTONS, bsp_event_handler);
|
||||
uint32_t err_code = bsp_init(BSP_INIT_BUTTONS, bsp_event_handler);
|
||||
APP_ERROR_CHECK(err_code);
|
||||
|
||||
led_init();
|
||||
|
||||
err_code = bsp_btn_ble_init(NULL, &startup_event);
|
||||
APP_ERROR_CHECK(err_code);
|
||||
|
||||
@@ -1342,7 +1344,7 @@ void assert_nrf_callback(uint16_t line_num, const uint8_t * p_file_name)
|
||||
*/
|
||||
void sleep_mode_enter(void)
|
||||
{
|
||||
bsp_indication_set(BSP_INDICATE_USER_STATE_ON);
|
||||
led_set_state(LED_STATE_POWER_OFF);
|
||||
DBG_PRINTF("[SYS] Sleep\r\n");
|
||||
APP_ERROR_CHECK(app_timer_start(m_power_off_delay_timer_id, APP_TIMER_TICKS(POWER_OFF_DELAY), NULL));
|
||||
}
|
||||
@@ -1355,7 +1357,7 @@ void sleep_mode_enter(void)
|
||||
*/
|
||||
void device_power_off(void)
|
||||
{
|
||||
bsp_indication_set(BSP_INDICATE_USER_STATE_ON);
|
||||
led_set_state(LED_STATE_POWER_OFF);
|
||||
APP_ERROR_CHECK(app_timer_start(m_power_off_delay_timer_id, APP_TIMER_TICKS(POWER_OFF_DELAY), NULL));
|
||||
}
|
||||
|
||||
@@ -1612,7 +1614,7 @@ static void main_s(void * p_context)
|
||||
if ((cnt_s < 150) && (m_reset_status != 2))
|
||||
{
|
||||
DBG_PRINTF("[BTN] Short->OFF\r\n");
|
||||
bsp_indication_set(BSP_INDICATE_USER_STATE_OFF);
|
||||
led_set_state(LED_STATE_OFF);
|
||||
power_control_handler(OFF);
|
||||
cnt_s = 0;
|
||||
}
|
||||
@@ -1654,7 +1656,7 @@ static void main_s(void * p_context)
|
||||
device_reset = false;
|
||||
|
||||
if (cnt_s == 150) {
|
||||
bsp_indication_set(BSP_INDICATE_USER_STATE_ON);
|
||||
led_set_state(LED_STATE_POWER_ON);
|
||||
DBG_PRINTF("[BTN] 1.5s\r\n");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user