添加参数读写的函数
This commit is contained in:
@@ -8,6 +8,11 @@
|
||||
#include "main.h"
|
||||
#include "tim.h"
|
||||
#include "adc.h"
|
||||
#include "drv_at24cxx.h"
|
||||
|
||||
|
||||
#define EEPROM_ADDR_BASE 0x10
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
@@ -91,6 +96,18 @@ typedef enum {
|
||||
}MOTOR_GET_FLAG_ENUM;
|
||||
|
||||
|
||||
typedef enum {
|
||||
|
||||
MOTOR_RUN_NORMAL = 0x00,
|
||||
MOTOR_RUN_ACC = 0x01,
|
||||
MOTOR_RUN_DEC = 0x02,
|
||||
MOTOR_RUN_STOP = 0x03
|
||||
|
||||
}MOTOR_RUN_FLAG_ENUM;
|
||||
|
||||
//电机有个参数定义哪个方向是正向,这样才能适应不同方向的电机
|
||||
|
||||
|
||||
typedef struct MOTOR_s
|
||||
{
|
||||
|
||||
@@ -98,6 +115,11 @@ typedef struct MOTOR_s
|
||||
MOTOR_DIR_ENUM dir;
|
||||
MOTOR_STATE_ENUM state;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
uint64_t length;
|
||||
|
||||
uint16_t period;
|
||||
@@ -164,10 +186,36 @@ extern SERIAL_t serial3;
|
||||
|
||||
|
||||
|
||||
typedef struct PAR_s
|
||||
{
|
||||
uint8_t state;//role key motor pad type
|
||||
// 0 0 0 0 0000
|
||||
//用来配置该板子是否为主机1,默认为从机0
|
||||
//按键极性,0 min为0x01 max 0x02,1 min为0x01 max 0x02
|
||||
//电机旋转的正方向,0 从后向前看,顺时针为正向,逆时针为反向,1则相反
|
||||
//驱动类型,0 用按键作为端点,1 用模拟量作为端点,2 串口输入作为端点 ,3无端点
|
||||
uint8_t pad1;
|
||||
uint8_t pad2;
|
||||
uint8_t pad3;
|
||||
uint64_t lenght;//端点的总长度,如果没有端点,则这个数为0
|
||||
|
||||
char name[20];
|
||||
|
||||
}PAR_t;
|
||||
|
||||
typedef PAR_t* PAR_ptr;
|
||||
|
||||
extern PAR_t parameters;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void SYS_initParam();
|
||||
void SYS_getParam();
|
||||
void SYS_setParam();
|
||||
|
||||
|
||||
unsigned char SYS_getID(void);
|
||||
unsigned char SYS_getDi(void);
|
||||
void SYS_setDo(unsigned char channel,unsigned char value);
|
||||
|
||||
Reference in New Issue
Block a user