encoder_driver.h 874 B

12345678910111213141516171819202122232425262728293031
  1. /**************************************************************
  2. Description: Encoder driver function definitions - by James Nugen
  3. Author: www.corvin.cn
  4. History: 20180209:init this file;
  5. *************************************************************/
  6. #ifndef __ENCODER_DRIVER_H__
  7. #define __ENCODER_DRIVER_H__
  8. //below can be changed, but should be PORTD pins;
  9. //A wheel encode pin
  10. #define ENC_A_PIN_A 20 //pin 20 -- interrupt 3
  11. #define ENC_A_PIN_B 21 //pin 21 -- interrupt 2
  12. //B wheel encode pin
  13. #define ENC_B_PIN_A 2 //pin 2 -- interrupt 0
  14. #define ENC_B_PIN_B 3 //pin 3 -- interrupt 1
  15. //C wheel encode pin
  16. #define ENC_C_PIN_A 18 //pin 18 -- interrupt 5
  17. #define ENC_C_PIN_B 19 //pin 19 -- interrupt 4
  18. #define A_WHEEL 1
  19. #define B_WHEEL 2
  20. #define C_WHEEL 3
  21. void initEncoders(void);
  22. long readEncoder(int i);
  23. void resetEncoders(void);
  24. #endif