123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- #include "app_task.h"
- #include "J1939.H"
- #include "app_eeprom.h"
- #include "ble_core.h"
- #include "can_task.h"
- #include "cli.h"
- #include "dev_at24cxx.h"
- #include "dev_task.h"
- #include "gpio.h"
- #include "key.h"
- #include "led.h"
- #include "uart_task.h"
- #include <stdint.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)
- {
- uart_task();
- 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();
- J1939_Poll();
- }
- /*----------------------------------------
- * @函数名: app_task_50ms
- * @描述:
- * @入参:
- * @出参: *pArr
- * @返回值: NONE
- * @调用:
- * @被调用:
- ----------------------------------------
- * 作者 创建时间 操作
- 樊春春 2023/11/13 Create/Modify
- ----------------------------------------*/
- static void app_task_50ms(void)
- {
- uint8_t buf[200] = {0};
- if (key_button.key_state.bits.key_up_state_flag == 1)
- {
- buf[0] = 10;
- ble_send();
- app_eeprom_write_50_zhuzu();
- key_button.key_state.bits.key_up_state_flag = 0;
- }
- if (key_button.key_state.bits.key0_state_flag == 1)
- {
- app_eeprom_read_50_zhuzu();
- key_button.key_state.bits.key0_state_flag = 0;
- }
- if (key_button.key_state.bits.key1_state_flag == 1)
- {
- dev_at24cxx_read_bytes(0, buf, 1);
- key_button.key_state.bits.key1_state_flag = 0;
- }
- if (key_button.key_state.bits.key2_state_flag == 1)
- {
- GPIO_BEEP(beep_status);
- beep_status = !beep_status;
- key_button.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;
- led_on_off(1, state);
- state = !state;
- led_on_off(1, 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 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)
- {
- 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;
- }
- }
|