|
|
@ -53,6 +53,7 @@ static void mf_process_poweron_key(key_t *key) { |
|
|
|
printf("key name:%s\n", key->name); |
|
|
|
|
|
|
|
if (!this_device.power) { |
|
|
|
mf_init_all_subdevice_state(); |
|
|
|
poweron(); |
|
|
|
} else { |
|
|
|
powerdown(); |
|
|
@ -62,6 +63,7 @@ static void mf_process_poweron_key(key_t *key) { |
|
|
|
} |
|
|
|
static void mf_process_level_key(key_t *key) { |
|
|
|
if (!this_device.power) { |
|
|
|
mf_init_all_subdevice_state(); |
|
|
|
return; |
|
|
|
} |
|
|
|
printf("key name:%s\n", key->name); |
|
|
@ -69,6 +71,7 @@ static void mf_process_level_key(key_t *key) { |
|
|
|
} |
|
|
|
static void mf_process_timer_key(key_t *key) { |
|
|
|
if (!this_device.power) { |
|
|
|
mf_init_all_subdevice_state(); |
|
|
|
return; |
|
|
|
} |
|
|
|
printf("key name:%s\n", key->name); |
|
|
@ -76,6 +79,7 @@ static void mf_process_timer_key(key_t *key) { |
|
|
|
} |
|
|
|
static void mf_process_interval_key(key_t *key) { |
|
|
|
if (!this_device.power) { |
|
|
|
mf_init_all_subdevice_state(); |
|
|
|
return; |
|
|
|
} |
|
|
|
printf("key name:%s\n", key->name); |
|
|
@ -96,6 +100,30 @@ static void onkey(key_t *key, key_state_t key_state) { |
|
|
|
|
|
|
|
key_module_t key_module = key_module_init(s_keys, onkey); |
|
|
|
|
|
|
|
//等级处理 |
|
|
|
void device_level_process() {} |
|
|
|
//定时处理 |
|
|
|
void device_time_process() {} |
|
|
|
|
|
|
|
void hcis_shcedule_process() { |
|
|
|
if (!this_device.power) { |
|
|
|
mf_init_all_subdevice_state(); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
device_level_process(); |
|
|
|
device_time_process(); |
|
|
|
} |
|
|
|
|
|
|
|
void hcis_shcedule() { |
|
|
|
static uint32_t ticket = 0; |
|
|
|
|
|
|
|
if (systicket_haspassedms(ticket) > 30) { |
|
|
|
ticket = systicket_get_now_ms(); |
|
|
|
hcis_shcedule_process(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void hardware_init() { |
|
|
|
SystemInit(); //配置系统时钟 |
|
|
|
DeviceClockAllEnable(); //打开所有外设时钟 |
|
|
@ -124,6 +152,8 @@ int main() { |
|
|
|
// debug light |
|
|
|
DO_IT_EACH_MS(150) { flip_debuf_light_level(); } |
|
|
|
END(); |
|
|
|
|
|
|
|
hcis_shcedule(); |
|
|
|
} |
|
|
|
|
|
|
|
return 0; |
|
|
|