2024-07-22 13:55:29 +08:00
|
|
|
|
#ifndef __ABZ_H
|
|
|
|
|
#define __ABZ_H
|
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
|
|
#define ENCODER_MAX_COUNT 4096 // <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ (16λ<36><CEBB>ʱ<EFBFBD><CAB1>)
|
|
|
|
|
#define ENCODER_HALF_COUNT (ENCODER_MAX_COUNT / 2) // <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>ֵ
|
|
|
|
|
|
|
|
|
|
typedef struct{
|
2024-07-26 14:51:23 +08:00
|
|
|
|
int32_t preCnt;
|
|
|
|
|
int32_t cnt;
|
|
|
|
|
int32_t offsetCnt;
|
|
|
|
|
int32_t angle;
|
|
|
|
|
int32_t elecAngle;
|
|
|
|
|
int32_t incCnt;
|
2024-07-22 13:55:29 +08:00
|
|
|
|
}ABZ_Encoder;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TIM2_M1_ABZ(void);
|
|
|
|
|
void Count_M1_ABZ(void);
|
|
|
|
|
|
|
|
|
|
void TIM3_M2_ABZ(void);
|
|
|
|
|
void Count_M2_ABZ(void);
|
|
|
|
|
|
2024-07-27 22:33:57 +08:00
|
|
|
|
//int16_t ModifyIncCnt(int16_t delta);
|
|
|
|
|
//int UpdateEncoderCnt(void);
|
2024-07-26 14:51:23 +08:00
|
|
|
|
|
|
|
|
|
float ABZ_GetAngle360(void);
|
|
|
|
|
float ABZ_GetAngle2PI(void);
|
|
|
|
|
float ABZ_GetAngle(void);
|
|
|
|
|
float ABZ_GetVelocity(void);
|
2024-07-27 22:33:57 +08:00
|
|
|
|
float ABZ_Get_Speed(void);
|
2024-07-26 14:51:23 +08:00
|
|
|
|
|
2024-07-22 13:55:29 +08:00
|
|
|
|
#endif
|