2024-01-08 22:30:20 +08:00
|
|
|
|
#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"
|
2024-01-08 22:30:20 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* @brief 注册需调参数
|
2024-03-02 16:05:24 +08:00
|
|
|
|
*
|
2024-01-08 22:30:20 +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_; \
|
2024-01-08 22:30:20 +08:00
|
|
|
|
Param_Data[_data_tag_].text = _text_;
|
2024-03-02 16:05:24 +08:00
|
|
|
|
|
2024-01-08 22:30:20 +08:00
|
|
|
|
typedef enum {
|
2024-03-02 16:05:24 +08:00
|
|
|
|
|
|
|
|
|
|
Page1_head = 0,
|
|
|
|
|
|
|
|
|
|
|
|
angle_Kp = Page1_head,
|
2024-01-16 20:03:21 +08:00
|
|
|
|
angle_Ki,
|
|
|
|
|
|
angle_Kd,
|
2024-03-02 16:05:24 +08:00
|
|
|
|
gyro_Kp,
|
|
|
|
|
|
gyro_Ki,
|
|
|
|
|
|
gyro_Kd,
|
|
|
|
|
|
speed_Kp,
|
|
|
|
|
|
speed_Ki,
|
|
|
|
|
|
speed_Kd,
|
|
|
|
|
|
pos_Kp,
|
|
|
|
|
|
pos_Ki,
|
|
|
|
|
|
pos_Kd,
|
|
|
|
|
|
param_set_speed,
|
|
|
|
|
|
|
|
|
|
|
|
Page2_head,
|
2024-01-08 22:30:20 +08:00
|
|
|
|
DATA_IN_FLASH_NUM,
|
2024-03-02 16:05:24 +08:00
|
|
|
|
|
|
|
|
|
|
delta_x,
|
|
|
|
|
|
delta_y,
|
2024-01-08 22:30:20 +08:00
|
|
|
|
DATA_NUM,
|
|
|
|
|
|
} data_tag_t;
|
2024-01-09 17:20:08 +08:00
|
|
|
|
|
2024-01-08 22:30:20 +08:00
|
|
|
|
typedef enum {
|
|
|
|
|
|
EUINT32,
|
|
|
|
|
|
EINT32,
|
|
|
|
|
|
EFLOAT,
|
2024-03-02 16:05:24 +08:00
|
|
|
|
} ENUM_TYPE;
|
2024-01-08 22:30:20 +08:00
|
|
|
|
|
2024-03-02 16:05:24 +08:00
|
|
|
|
typedef union {
|
2024-01-16 20:03:21 +08:00
|
|
|
|
uint32_t u32;
|
|
|
|
|
|
int32_t s32;
|
2024-01-08 22:30:20 +08:00
|
|
|
|
float f32;
|
2024-01-16 20:03:21 +08:00
|
|
|
|
uint8_t u8;
|
2024-03-02 16:05:24 +08:00
|
|
|
|
} TYPE_UNION;
|
2024-01-08 22:30:20 +08:00
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
|
void *p_data;
|
|
|
|
|
|
ENUM_TYPE type;
|
2024-03-02 16:05:24 +08:00
|
|
|
|
uint8_t cmd; // 01:仅存储 00:仅显示 02:传输并显示
|
2024-01-08 22:30:20 +08:00
|
|
|
|
char *text;
|
2024-03-02 16:05:24 +08:00
|
|
|
|
} PARAM_INFO;
|
2024-01-08 22:30:20 +08:00
|
|
|
|
|
|
|
|
|
|
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;
|
2024-01-08 22:30:20 +08:00
|
|
|
|
#endif
|