123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- #include "app_task.h"
- #include "app_eeprom.h"
- #include "cli.h"
- #include "dev_at24cxx.h"
- #include "dev_can.h"
- #include "hal_systick.h"
- #include <stdint.h>
- #include <stdio.h>
- uint8_t beep_status = 1;
- static uint32_t systick_ms_clock = 0;
- /*----------------------------------------
- * @函数名: app_task_5ms
- * @描述:
- * @入参:
- * @出参: *pArr
- * @返回值: NONE
- * @调用:
- * @被调用:
- ----------------------------------------
- * 作者 创建时间 操作
- 樊春春 2023/11/13 Create/Modify
- ----------------------------------------*/
- static void app_task_5ms(void)
- {
- dev_key_button_task();
- can_process();
- cli_loop();
- }
- /*----------------------------------------
- * @函数名: app_task_10ms
- * @描述:
- * @入参:
- * @出参: *pArr
- * @返回值: NONE
- * @调用:
- * @被调用:
- ----------------------------------------
- * 作者 创建时间 操作
- 樊春春 2023/11/13 Create/Modify
- ----------------------------------------*/
- static void app_task_10ms(void)
- {
- app_eeprom_read_task();
- app_eeprom_write_task();
- }
- /*----------------------------------------
- * @函数名: app_task_50ms
- * @描述:
- * @入参:
- * @出参: *pArr
- * @返回值: NONE
- * @调用:
- * @被调用:
- ----------------------------------------
- * 作者 创建时间 操作
- 樊春春 2023/11/13 Create/Modify
- ----------------------------------------*/
- static void app_task_50ms(void)
- {
- uint8_t buf[200] = {0};
- if (dev_key.dev_key_state.bits.key_up_state_flag == 1)
- {
- buf[0] = 10;
- // dev_at24cxx_write_bytes(0, &buf[99], 1);
- app_eeprom_write_50_zhuzu();
- dev_key.dev_key_state.bits.key_up_state_flag = 0;
- }
- if (dev_key.dev_key_state.bits.key0_state_flag == 1)
- {
- app_eeprom_read_50_zhuzu();
- // printf("%d\r\n", read_buf[33]);
- dev_key.dev_key_state.bits.key0_state_flag = 0;
- }
- if (dev_key.dev_key_state.bits.key1_state_flag == 1)
- {
- dev_at24cxx_read_bytes(0, buf, 1);
- printf("%d\r\n,%d\r\n", buf[0], buf[0]);
- dev_key.dev_key_state.bits.key1_state_flag = 0;
- }
- if (dev_key.dev_key_state.bits.key2_state_flag == 1)
- {
- printf("33333333\r\n");
- HAL_GPIO_BEEP(beep_status);
- beep_status = !beep_status;
- dev_key.dev_key_state.bits.key2_state_flag = 0;
- }
- }
- /*----------------------------------------
- * @函数名: app_task_100ms
- * @描述:
- * @入参:
- * @出参: *pArr
- * @返回值: NONE
- * @调用:
- * @被调用:
- ----------------------------------------
- * 作者 创建时间 操作
- 樊春春 2023/11/13 Create/Modify
- ----------------------------------------*/
- static void app_task_100ms(void)
- {
- }
- /*----------------------------------------
- * @函数名: app_task_200ms
- * @描述:
- * @入参:
- * @出参: *pArr
- * @返回值: NONE
- * @调用:
- * @被调用:
- ----------------------------------------
- * 作者 创建时间 操作
- 樊春春 2023/11/13 Create/Modify
- ----------------------------------------*/
- static void app_task_200ms(void)
- {
- }
- /*----------------------------------------
- * @函数名: app_task_500ms
- * @描述:
- * @入参:
- * @出参: *pArr
- * @返回值: NONE
- * @调用:
- * @被调用:
- ----------------------------------------
- * 作者 创建时间 操作
- 樊春春 2023/11/13 Create/Modify
- ----------------------------------------*/
- static void app_task_500ms(void)
- {
- }
- /*----------------------------------------
- * @函数名: app_task_1000ms
- * @描述:
- * @入参:
- * @出参: *pArr
- * @返回值: NONE
- * @调用:
- * @被调用:
- ----------------------------------------
- * 作者 创建时间 操作
- 樊春春 2023/11/13 Create/Modify
- ----------------------------------------*/
- static void app_task_1000ms(void)
- {
- static volatile uint8_t state = 0;
- dev_led_on_off(1, state);
- state = !state;
- dev_led_on_off(0, state);
- systick_ms_clock++;
- // printf("debug\r\n");
- // dev_led_on_off(1, !state);
- }
- /*----------------------------------------
- * @函数名: app_task_2000ms
- * @描述:
- * @入参:
- * @出参: *pArr
- * @返回值: NONE
- * @调用:
- * @被调用:
- ----------------------------------------
- * 作者 创建时间 操作
- 樊春春 2023/11/13 Create/Modify
- ----------------------------------------*/
- static void app_task_2000ms(void)
- {
- }
- void SysTick_Handler(void)
- {
- dev_task_clock();
- dev_systick_decrement();
- dev_systick_increase();
- systick_handler();
- jump_boot_time_ctrl();
- }
- void app_task_schdule(void)
- {
- if (dev_task_flag.bits.task0_flag)
- {
- app_task_5ms();
- dev_task_flag.bits.task0_flag = 0;
- }
- // if (dev_task_flag.bits.task1_flag && (!(dev_task_flag.all & task1_mask)))
- // {
- // app_task_10ms();
- // dev_task_flag.bits.task1_flag = 0;
- // }
- if (dev_task_flag.bits.task1_flag)
- {
- app_task_10ms();
- dev_task_flag.bits.task1_flag = 0;
- }
- if (dev_task_flag.bits.task2_flag)
- {
- app_task_50ms();
- dev_task_flag.bits.task2_flag = 0;
- }
- if (dev_task_flag.bits.task3_flag)
- {
- app_task_100ms();
- dev_task_flag.bits.task3_flag = 0;
- }
- if (dev_task_flag.bits.task4_flag)
- {
- app_task_200ms();
- dev_task_flag.bits.task4_flag = 0;
- }
- if (dev_task_flag.bits.task5_flag)
- {
- app_task_500ms();
- dev_task_flag.bits.task5_flag = 0;
- }
- if (dev_task_flag.bits.task6_flag)
- {
- app_task_1000ms();
- dev_task_flag.bits.task6_flag = 0;
- }
- if (dev_task_flag.bits.task7_flag)
- {
- app_task_2000ms();
- dev_task_flag.bits.task7_flag = 0;
- }
- }
|