2025-02-26 09:59:15 +00:00
|
|
|
|
|
|
|
|
|
#include "freerotsTask.h"
|
|
|
|
|
|
|
|
|
|
#include "uart_dev.h"
|
|
|
|
|
#include "FM_GPIO.h"
|
|
|
|
|
#include "FM_ADC.h"
|
2025-02-28 08:57:09 +00:00
|
|
|
|
#include "queueUart.h"
|
|
|
|
|
|
|
|
|
|
#include "stdio.h"
|
2025-02-26 09:59:15 +00:00
|
|
|
|
|
2025-02-28 08:57:09 +00:00
|
|
|
|
#define Common_TASK_PRIO 5
|
|
|
|
|
#define Common_STK_SIZE 256
|
2025-02-26 09:59:15 +00:00
|
|
|
|
|
2025-02-28 08:57:09 +00:00
|
|
|
|
#define Transmit_TASK_PRIO 5
|
|
|
|
|
#define Transmit_STK_SIZE 256
|
|
|
|
|
|
|
|
|
|
TaskHandle_t CommonTask_Handler;
|
|
|
|
|
TaskHandle_t TransmitTask_Handler;
|
2025-02-26 09:59:15 +00:00
|
|
|
|
uint8_t data[20] = "hello world\n";
|
|
|
|
|
|
2025-02-28 08:57:09 +00:00
|
|
|
|
void common_Task(void *pvParameters)
|
2025-02-26 09:59:15 +00:00
|
|
|
|
{
|
2025-02-28 08:57:09 +00:00
|
|
|
|
// writePwrCtrlState(Android_PwrCtrl, PwrCtrlOpen);
|
|
|
|
|
// proportionalInt();
|
|
|
|
|
// while(1) {
|
|
|
|
|
// // printf("task1 entry\r\n");
|
|
|
|
|
// printf_adc_data();
|
|
|
|
|
// USART_ITConfig(UART5, USART_IT_TXE, ENABLE);
|
|
|
|
|
// uartInterruptSend(g_Upward_uart5_handle, data, 12);
|
|
|
|
|
// vTaskDelay(1000);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
|
uint8_t *Buff = (uint8_t *)pvPortMalloc(200);
|
|
|
|
|
if (Buff == NULL) {
|
|
|
|
|
log_error("Memory allocation failed\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
queueUartSendInfo *sendBuff = (queueUartSendInfo *)Buff;
|
|
|
|
|
sendBuff->length = sizeof("hello world\n");
|
|
|
|
|
sendBuff->data = Buff + sizeof(queueUartSendInfo);
|
|
|
|
|
strlcpy((char *)sendBuff->data, "hello world\n", sizeof("hello world\n"));
|
|
|
|
|
|
|
|
|
|
xQueueSend(upward_uart_Queue, &Buff, 10);
|
2025-02-26 09:59:15 +00:00
|
|
|
|
vTaskDelay(1000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-28 08:57:09 +00:00
|
|
|
|
void transmit_Task(void *pvParameters)
|
|
|
|
|
{
|
|
|
|
|
while (1) {
|
|
|
|
|
uartQueueSend();
|
|
|
|
|
/* <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD> */
|
|
|
|
|
vTaskDelay(3);
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-02-26 09:59:15 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param
|
|
|
|
|
* @retval
|
|
|
|
|
*/
|
|
|
|
|
void startApp(void)
|
|
|
|
|
{
|
|
|
|
|
Init_Upward_uart(115200);
|
|
|
|
|
FM_GPIO_Init();
|
|
|
|
|
FM_ADC_Init();
|
|
|
|
|
|
2025-02-28 08:57:09 +00:00
|
|
|
|
|
|
|
|
|
uartQueueInit();
|
|
|
|
|
|
2025-02-26 09:59:15 +00:00
|
|
|
|
/* create task */
|
2025-02-28 08:57:09 +00:00
|
|
|
|
xTaskCreate((TaskFunction_t )common_Task,
|
|
|
|
|
(const char* )"commonTask",
|
|
|
|
|
(uint16_t )Common_STK_SIZE,
|
2025-02-26 09:59:15 +00:00
|
|
|
|
(void* )NULL,
|
2025-02-28 08:57:09 +00:00
|
|
|
|
(UBaseType_t )Common_TASK_PRIO,
|
|
|
|
|
(TaskHandle_t* )&CommonTask_Handler);
|
|
|
|
|
|
|
|
|
|
xTaskCreate((TaskFunction_t )transmit_Task,
|
|
|
|
|
(const char* )"transmitTask",
|
|
|
|
|
(uint16_t )Transmit_STK_SIZE,
|
|
|
|
|
(void* )NULL,
|
|
|
|
|
(UBaseType_t )Transmit_TASK_PRIO,
|
|
|
|
|
(TaskHandle_t* )&TransmitTask_Handler);
|
|
|
|
|
|
2025-02-26 09:59:15 +00:00
|
|
|
|
vTaskStartScheduler();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|