Hall Switch  2.1.0
C++ library of Infineon single Hall-effect switch family for magnetic sensing applications
hall-speed.hpp
Go to the documentation of this file.
1 
10 #ifndef HALL_SPEED_HPP_
11 #define HALL_SPEED_HPP_
12 
13 #include "../config/hall-conf.hpp"
14 #if (HALL_SPEED_ENABLED == 1)
15 
16 #include "hall-switch.hpp"
17 
23 class HallSpeed: public HallSwitch
24 {
25  public:
26 
32  {
33  HERTZ = 0,
34  RADS = 1,
35  RPM = 2
36  };
44  typedef void (*CBackSpd_t)(double);
45 
49  class Timer;
50 
51  HallSpeed ();
53  Timer *timer,
54  uint8_t polesNum = 1,
55  SpeedUnit_t units = HERTZ,
56  CBackSpd_t cBack = NULL,
57  GPIO *power = NULL);
58  ~HallSpeed ();
59  Error_t init ();
60  Error_t deinit ();
61  Error_t enable ();
62  Error_t disable ();
64  double getSpeed ();
65 
66  protected:
68  uint8_t polesPair;
70  double speed;
72  static double const speedCoeff[3];
73 
74  void callback ();
75  void calculateSpeed ();
76 };
77 
80 #endif
81 #endif
Error_t disable()
Disables the sensor.
Definition: hall-speed.cpp:174
Definition: hall-speed.hpp:34
Definition: hall-speed.hpp:33
Hall Switch API.
CBack_t cBack
Definition: hall-switch.hpp:122
HallSpeed()
Hall Speed Default Constructor.
Definition: hall-speed.cpp:30
Error_t enable()
Enables the sensor.
Definition: hall-speed.cpp:149
void callback()
Interrupt mode callback function.
Definition: hall-speed.cpp:245
Error_t
Definition: hall-switch.hpp:30
void(* CBackSpd_t)(double)
Callback function type for interrupt mode.
Definition: hall-speed.hpp:44
Definition: hall-pal-timer.hpp:23
Timer * timer
Definition: hall-speed.hpp:67
GPIO * output
Definition: hall-switch.hpp:119
uint8_t polesPair
Definition: hall-speed.hpp:68
static double const speedCoeff[3]
Definition: hall-speed.hpp:72
~HallSpeed()
Hall Speed Destructor Disables the sensor:
Definition: hall-speed.cpp:82
Error_t deinit()
Deinitializes the hardware interfaces.
Definition: hall-speed.cpp:122
Error_t updateSpeed()
Updates the instance speed value.
Definition: hall-speed.cpp:199
Definition: hall-speed.hpp:35
double getSpeed()
Gets speed value.
Definition: hall-speed.cpp:232
Error_t init()
Initializes the hardware interfaces.
Definition: hall-speed.cpp:97
Definition: hall-switch.hpp:22
SpeedUnit_t sUnits
Definition: hall-speed.hpp:69
Definition: hall-speed.hpp:23
GPIO * power
Definition: hall-switch.hpp:125
double speed
Definition: hall-speed.hpp:70
void calculateSpeed()
Calculates the speed in the configured units.
Definition: hall-speed.cpp:272
SpeedUnit_t
Definition: hall-speed.hpp:31
Definition: hall-pal-gpio.hpp:20