00001 #ifndef ENC_CTRL_H 00002 #define ENC_CTRL_H 00003 00015 #include "robotParams.h" 00016 00017 00023 enum EncDirSetting { 00024 ENC_CCW_TO_PLUSE = -1, 00025 ENC_CW_TO_PLUSE = +1, 00026 }; 00027 00028 00029 #ifndef ENC_PULSE 00030 #define ENC_PULSE 512 * 4 00031 #endif 00032 00033 00039 typedef struct { 00040 short diff; 00041 unsigned short prev; 00042 unsigned char id; 00043 char enc_direction; 00044 int total; 00045 } encInfo_t; 00046 00047 00048 #include "cpp_extern_macro.h" 00049 BEGIN_C_DECLS; 00050 00051 extern void initEnc(void); 00052 extern void initEncInfo(const unsigned char id, encInfo_t *enc); 00053 extern void updateEncDiff(encInfo_t *enc); 00054 extern int getEncDiff(encInfo_t *enc); 00055 00056 END_C_DECLS; 00057 #endif /* !ENC_CTRL_H */ 00058