Files
QD4C-firmware/app/jj_param.h

99 lines
1.8 KiB
C
Raw Normal View History

#ifndef _JJ_PARAM_H_
#define _JJ_PARAM_H_
2024-01-16 20:03:21 +08:00
#include "stdio.h"
#include "ch32v30x.h"
#include "zf_driver_soft_iic.h"
/**
* @brief
2024-03-02 16:05:24 +08:00
*
*/
2024-03-02 16:05:24 +08:00
#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_;
2024-03-02 16:05:24 +08:00
typedef enum {
2024-03-02 16:05:24 +08:00
Page1_head = 0,
2024-06-07 21:55:55 +08:00
// 完道pid
2024-03-28 04:24:59 +08:00
angle_Kp0 = Page1_head,
angle_Ki0,
angle_Kd0,
2024-06-07 21:55:55 +08:00
2024-03-28 04:24:59 +08:00
gyro_Kp0,
gyro_Ki0,
gyro_Kd0,
2024-06-07 21:55:55 +08:00
can_Kp1,
can_Ki1,
can_Kd1,
fly_pwm,
2024-03-28 04:24:59 +08:00
param_set_speed0,
2024-06-07 21:55:55 +08:00
// 直道pid
2024-03-02 16:05:24 +08:00
Page2_head,
2024-03-28 04:24:59 +08:00
angle_Kp1 = Page2_head,
angle_Ki1,
angle_Kd1,
2024-06-07 21:55:55 +08:00
2024-03-28 04:24:59 +08:00
gyro_Kp1,
gyro_Ki1,
gyro_Kd1,
2024-06-07 21:55:55 +08:00
2024-03-28 04:24:59 +08:00
pos_Kp1,
pos_Ki1,
pos_Kd1,
2024-06-07 21:55:55 +08:00
2024-03-28 04:24:59 +08:00
param_set_speed1,
2024-06-07 21:55:55 +08:00
// 圆环皮带
Page3_head,
yuan_Kp0 = Page3_head,
yuan_Ki0,
yuan_Kd0,
yugyro_Kp0,
yugyro_Ki0,
yugyro_Kd0,
speed_Kp,
speed_Ki,
speed_Kd,
param_set_speed2,
DATA_IN_FLASH_NUM,
2024-03-02 16:05:24 +08:00
delta_x,
delta_y,
DATA_NUM,
} data_tag_t;
typedef enum {
EUINT32,
EINT32,
EFLOAT,
2024-03-02 16:05:24 +08:00
} ENUM_TYPE;
2024-03-02 16:05:24 +08:00
typedef union {
2024-01-16 20:03:21 +08:00
uint32_t u32;
int32_t s32;
float f32;
2024-03-30 11:51:14 +08:00
uint8_t u8[4];
2024-03-02 16:05:24 +08:00
} TYPE_UNION;
typedef struct {
void *p_data;
ENUM_TYPE type;
2024-03-02 16:05:24 +08:00
uint8_t cmd; // 01:仅存储 00仅显示 02传输并显示
char *text;
2024-03-02 16:05:24 +08:00
} 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];
2024-03-03 19:23:21 +08:00
extern TYPE_UNION temp_frame_param[20];
2024-03-02 16:05:24 +08:00
void jj_param_eeprom_init(void);
void jj_param_write(void);
void jj_param_read(void);
extern float data7;
#endif