Hall Switch 2.1.0
C++ library of Infineon single Hall-effect switch family for magnetic sensing applications
 
Loading...
Searching...
No Matches
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"
23class 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 Hall_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
Definition hall-pal-timer.hpp:24
Definition hall-speed.hpp:24
double speed
Definition hall-speed.hpp:70
Error_t enable()
Enables the sensor.
Definition hall-speed.cpp:149
Error_t updateSpeed()
Updates the instance speed value.
Definition hall-speed.cpp:199
void calculateSpeed()
Calculates the speed in the configured units.
Definition hall-speed.cpp:272
Error_t deinit()
Deinitializes the hardware interfaces.
Definition hall-speed.cpp:122
Timer * timer
Definition hall-speed.hpp:67
static double const speedCoeff[3]
Definition hall-speed.hpp:17
void(* CBackSpd_t)(double)
Callback function type for interrupt mode.
Definition hall-speed.hpp:44
SpeedUnit_t
Definition hall-speed.hpp:32
@ HERTZ
Definition hall-speed.hpp:33
@ RADS
Definition hall-speed.hpp:34
@ RPM
Definition hall-speed.hpp:35
Error_t disable()
Disables the sensor.
Definition hall-speed.cpp:174
uint8_t polesPair
Definition hall-speed.hpp:68
void callback()
Interrupt mode callback function.
Definition hall-speed.cpp:245
SpeedUnit_t sUnits
Definition hall-speed.hpp:69
Error_t init()
Initializes the hardware interfaces.
Definition hall-speed.cpp:97
double getSpeed()
Gets speed value.
Definition hall-speed.cpp:232
HallSpeed()
Hall Speed Default Constructor.
Definition hall-speed.cpp:30
~HallSpeed()
Hall Speed Destructor Disables the sensor:
Definition hall-speed.cpp:82
Definition hall-pal-gpio.hpp:21
Definition hall-switch.hpp:23
CBack_t cBack
Definition hall-switch.hpp:122
Error_t
Definition hall-switch.hpp:31
Hall_GPIO * power
Definition hall-switch.hpp:125
Hall_GPIO * output
Definition hall-switch.hpp:119
Hall Switch API.