avatar

松果工作室

欢迎光临

  • 首页
  • freeRTOS
  • ESP
  • 开发手册
  • 快速笔记
  • 个人收藏
  • 工具
Home 结构体指针传参
文章

结构体指针传参

Posted 2024-06-27 Updated 2024-06- 27
By YCP
4~6 min read

具名结构体创建结构体

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);
}
Others
License:  CC BY 4.0
Share

Further Reading

OLDER

samba

NEWER

LVGL UI 代码格式

Recently Updated

  • ESP32(八) 简单的webserver
  • ESP32(七) NVS
  • ESP32(四) STA & AP
  • 多级菜单
  • ESP32(五) ESP32 OTA

Trending Tags

WCH Linux Elec freeRTOS STM ESP Flutter Others SwiftUI

Contents

©2025 松果工作室. Some rights reserved.

Using the Halo theme Chirpy