diff --git a/APP/main.c b/APP/main.c index 9aa8814..68deed1 100644 --- a/APP/main.c +++ b/APP/main.c @@ -88,6 +88,13 @@ static void mf_process_timer_key(key_t *key) { return; } printf("key name:%s\n", key->name); + + if (this_device.configuration_mode == false) { + this_device.configuration_start_time = systicket_get_now_ms(); + this_device.configuration_mode = true; + } else { + } + return; } static void mf_process_interval_key(key_t *key) { @@ -143,6 +150,23 @@ void hcis_shcedule() { } } +void configuration_shcedule() { + static bool led_state; + static uint32_t led_ticket = 0; + if (this_device.configuration_mode == true) { + if (systicket_haspassedms(this_device.configuration_start_time) > 1000) { + this_device.configuration_mode = false; + mf_init_all_subdevice_state(); + } + + if (systicket_haspassedms(led_ticket) > 100) { + led_ticket = systicket_get_now_ms(); + port_led0_set(led_state); + led_state = !led_state; + } + } +} + void hardware_init() { SystemInit(); //配置系统时钟 DeviceClockAllEnable(); //打开所有外设时钟 @@ -173,6 +197,7 @@ int main() { END(); hcis_shcedule(); + configuration_shcedule(); } return 0; diff --git a/APP/this_device.h b/APP/this_device.h index 829acce..ea5690d 100644 --- a/APP/this_device.h +++ b/APP/this_device.h @@ -19,4 +19,5 @@ typedef struct { ozone_module_t ozone_module; bool configuration_mode; + uint32_t configuration_start_time; } ThisDevice_t;