hall_sensor.h 567 B

1234567891011121314151617181920212223242526
  1. #ifndef _HALL_SENSOR_H__
  2. #define _HALL_SENSOR_H__
  3. #include "libs/types.h"
  4. #include "hal/hal.h"
  5. #define NEGATIVE (int8_t)-1
  6. #define POSITIVE (int8_t)1
  7. #define THETA_NONE (float)0xFFFF
  8. typedef struct {
  9. bool alignmnet;
  10. float theta;
  11. float rpm; //ÿ·ÖÖÓתËÙ
  12. u8 state;
  13. u32 ticks;
  14. bool working;
  15. s8 direction;
  16. float degree_per_s; //ÿÃë¶È£¬ ext: 10¶È/s
  17. }hall_t;
  18. void hall_sensor_init(void);
  19. float hall_sensor_get_theta(void); //return degree
  20. float hall_sensor_get_speed(void); //return rpm
  21. #endif /* _HALL_SENSOR_H__ */