一、文件结构:头文件、定义文件
头文件内容规范
- 版本信息
- 预处理块
- 函数声明
- For example:
/*
* @ Version Information:
* @ current version: v0.0
* @ File name: monitor_task.h
* @ Summary: This file and the open source flight control platform
* PX4 PC QGroundControl communication
* @ Author: Yancy
* @ Date: 2017.11.16
* @ Version history information:
*/
//Prevent header files from being re-referenced
#ifndef _MONITOR_TASK_H_
#define _MONITOR_TASK_H_
//Reference standard library header files
#include <stdint.h>
//Reference non-standard library header files
#include "mavlink.h"
#define Monitor_Device MONITOR_DEVICE_UART
typedef struct
{
char name[16];
Param_Type type;
void* data;
float max;
float min;
}Param;
typedef enum
{
PARAM_IMU_P,
KEYLEVEL,
PARAM_ID_NUM
}Param_id;定义文件内容规范
void param_init(void);
void monitor_task_init(void);
void monitor_uart_get_decode(uint8_t read_c);
void monitor_usb_get_decode(void);
void monitor_default_send_task(MONITOR_DEVICE device,uint16_t send_frequency);
#endif
- 版本信息
- 头文件引用
- 函数体实现