Files
QD4C-firmware/app/jj_param.h

71 lines
1.4 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef _JJ_PARAM_H_
#define _JJ_PARAM_H_
#include "stdio.h"
#include "ch32v30x.h"
#include "zf_driver_soft_iic.h"
/**
* @brief 注册需调参数
*
*/
#define PARAM_REG(_data_tag_, _p_data_, _type_, _cmd_, _text_) \
Param_Data[_data_tag_].p_data = (void *)_p_data_; \
Param_Data[_data_tag_].type = _type_; \
Param_Data[_data_tag_].cmd = _cmd_; \
Param_Data[_data_tag_].text = _text_;
typedef enum {
Page1_head = 0,
angle_Kp = Page1_head,
angle_Ki,
angle_Kd,
gyro_Kp,
gyro_Ki,
gyro_Kd,
speed_Kp,
speed_Ki,
speed_Kd,
pos_Kp,
pos_Ki,
pos_Kd,
param_set_speed,
Page2_head,
DATA_IN_FLASH_NUM,
delta_x,
delta_y,
DATA_NUM,
} data_tag_t;
typedef enum {
EUINT32,
EINT32,
EFLOAT,
} ENUM_TYPE;
typedef union {
uint32_t u32;
int32_t s32;
float f32;
uint8_t u8;
} TYPE_UNION;
typedef struct {
void *p_data;
ENUM_TYPE type;
uint8_t cmd; // 01:仅存储 00仅显示 02传输并显示
char *text;
} PARAM_INFO;
extern soft_iic_info_struct eeprom_param;
extern PARAM_INFO Param_Data[DATA_NUM];
extern TYPE_UNION iic_buffer[DATA_IN_FLASH_NUM];
extern TYPE_UNION temp_frame_param[20];
void jj_param_eeprom_init(void);
void jj_param_write(void);
void jj_param_read(void);
extern float data7;
#endif