结构体指针传参
具名结构体创建结构体
struct uart_config_me {
uart_port_t uart_num;
QueueHandle_t xQueue;
}uart_config_me;
void create_uart_event_task(struct uart_config_me *config_me,int baud){
struct uart_config_me *value_ptr = (struct uart_config_me *)malloc(sizeof(int));
*value_ptr = *config_me;
xTaskCreate(uart_event_task, "uart_event_task", 2048, (void *)value_ptr, 12, NULL);
}
声明结构体
typedef struct {
char name[50];
int age;
} Student;
void create_uart_event_task(uart_config_me *config_me,int baud){
uart_config_me *value_ptr = (uart_config_me *)malloc(sizeof(int));
*value_ptr = *config_me;
xTaskCreate(uart_event_task, "uart_event_task", 2048, (void *)value_ptr, 12, NULL);
}
License:
CC BY 4.0