Files
QDAC-firmware/app/jj_param.h

63 lines
1.2 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-02-24 15:06:30 +08:00
*
*/
2024-02-24 15:06:30 +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-02-24 15:06:30 +08:00
typedef enum {
2024-02-24 15:06:30 +08:00
Page1_head=0,
angle_Kp=Page1_head,
2024-01-16 20:03:21 +08:00
angle_Ki,
angle_Kd,
2024-02-24 15:06:30 +08:00
other,
Page2_head,
// 第二页参数
imgax_Kp=Page2_head,
2024-01-16 20:03:21 +08:00
imgax_Ki,
imgax_Kd,
2024-02-24 15:06:30 +08:00
Page3_head,
DATA_IN_FLASH_NUM,
DATA_NUM,
} data_tag_t;
typedef enum {
EUINT32,
EINT32,
EFLOAT,
2024-02-24 15:06:30 +08:00
} ENUM_TYPE;
2024-02-24 15:06:30 +08:00
typedef union {
2024-01-16 20:03:21 +08:00
uint32_t u32;
int32_t s32;
float f32;
2024-01-16 20:03:21 +08:00
uint8_t u8;
2024-02-24 15:06:30 +08:00
} TYPE_UNION;
typedef struct {
void *p_data;
ENUM_TYPE type;
2024-01-16 20:03:21 +08:00
uint8_t cmd;
char *text;
2024-02-24 15:06:30 +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-02-24 15:06:30 +08:00
void jj_param_eeprom_init(void);
void jj_param_write(void);
void jj_param_read(void);
#endif