| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- #include "gd32f4xx_libopt.h"
- #include "bsp_enet.h"
- #include "bsp_print.h"
- #include "bsp_flash.h"
- #include "bsp_rtc.h"
- #include "bsp_cas.h"
- #include "bsp_ctrl.h"
- #include "bsp_sensor.h"
- #include "bsp_lcd.h"
- #include "systick.h"
- #include "FreeRTOS.h"
- #include "task.h"
- #include "arch/netconf.h"
- #include "lfs_file.h"
- #include "modbus.h"
- #include "power.h"
- #include "snmp.h"
- #include "paras.h"
- #include "sensor.h"
- #include "beep.h"
- #include "cascade.h"
- #include "web.h"
- #include "menu.h"
- typedef uint8_t u8;
- #define START_TASK_PRIO 4 /* 任务优先级 */
- #define START_STK_SIZE 256 /* 任务堆栈大小 */
- TaskHandle_t StartTask_Handler; /* 任务句柄 */
- void start_task(void *pvParameters); /* 任务函数 */
- #define LWIP_DMEO_TASK_PRIO 5 /* 任务优先级 */
- #define LWIP_DMEO_STK_SIZE 2048 /* 任务堆栈大小 */
- TaskHandle_t LWIP_Task_Handler; /* 任务句柄 */
- void lwip_demo_task(void *pvParameters); /* 任务函数 */
- int main(void)
- {
- __IO int i = 0;
- nvic_priority_group_set(NVIC_PRIGROUP_PRE4_SUB0);
-
- systick_config();
- bsp_print_init(115200);
- // bsp_rtc_init();
- // bsp_ctrl_init();
- // bsp_sensor_init();
- // bsp_lcd_init();
- // enet_phy_init();
- rcu_periph_clock_enable(RCU_GPIOE);
- gpio_mode_set(GPIOE, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP,GPIO_PIN_6);
- gpio_output_options_set(GPIOE, GPIO_OTYPE_PP, GPIO_OSPEED_MAX, GPIO_PIN_6);
- gpio_bit_set(GPIOE,GPIO_PIN_6);
-
-
- W25qxx_Init();
- /* start_task任务 */
- xTaskCreate((TaskFunction_t )start_task,
- (const char * )"start_task",
- (uint16_t )START_STK_SIZE,
- (void * )NULL,
- (UBaseType_t )START_TASK_PRIO,
- (TaskHandle_t * )&StartTask_Handler);
- vTaskStartScheduler(); /* 开启任务调度 */
-
- while(1)
- {
- i ++;
- }
-
- return 0;
- }
- void start_task(void *pvParameters)
- {
-
- taskENTER_CRITICAL();
- xTaskCreate((TaskFunction_t )lwip_demo_task,
- (const char* )"lwip_demo_task",
- (uint16_t )LWIP_DMEO_STK_SIZE,
- (void* )NULL,
- (UBaseType_t )LWIP_DMEO_TASK_PRIO,
- (TaskHandle_t* )&LWIP_Task_Handler);
-
- vTaskDelete(StartTask_Handler);
-
-
- taskEXIT_CRITICAL();
-
- }
- void lwip_demo_task(void *pvParameters)
- {
- int i = 0;
- l_file_init();
-
- while(1)
- {
- i++;
- if(i % 2 == 0)
- {
- gpio_bit_reset(GPIOE,GPIO_PIN_6);
- }else
- {
- gpio_bit_set(GPIOE,GPIO_PIN_6);
- }
- vTaskDelay(1000);
- }
- vTaskDelete( LWIP_Task_Handler );
- }
|