Hall Switch  2.1.0
C++ library of Infineon single Hall-effect switch family for magnetic sensing applications
hall-switch.hpp
Go to the documentation of this file.
1 
10 #ifndef HALL_SWITCH_HPP_
11 #define HALL_SWITCH_HPP_
12 
13 #include <stdlib.h>
14 #include <stdint.h>
15 
16 
23 {
24  public:
25 
30  enum Error_t
31  {
32  OK = 0,
33  INTF_ERROR = -1,
34  CONF_ERROR = -2,
35  };
43  {
44  MAIN = 1,
45  SWITCH = 2,
46  };
53  enum Status_t
54  {
55  UNINITED = 0,
56  INITED = 1,
57  POWER_ON = 2,
58  POWER_OFF = 3,
59  };
67  {
68  POLLING = 1,
69  INTERRUPT = 2,
70  };
77  enum Result_t
78  {
81  B_FIELD_ON = 1,
82  };
91  typedef void (*CBack_t)(Result_t);
92 
96  class GPIO;
97 
101  class Interrupt;
102 
103  HallSwitch ();
105  CBack_t cBack = NULL,
106  GPIO *power = NULL);
107  ~HallSwitch ();
108  Error_t init ();
109  Error_t deinit ();
110  Error_t enable ();
111  Error_t disable ();
112  Status_t getStatus ();
114  Result_t getBField ();
115 
116  protected:
117 
128  virtual void callback ();
129 
130 };
131 
134 #endif
Definition: hall-switch.hpp:33
CBack_t cBack
Definition: hall-switch.hpp:122
Definition: hall-switch.hpp:57
Error_t init()
Initializes the hardware interfaces.
Definition: hall-switch.cpp:90
Status_t getStatus()
Gets the sensor status.
Definition: hall-switch.cpp:241
MeasMode_t
Definition: hall-switch.hpp:66
Definition: hall-switch.hpp:34
Definition: hall-switch-int.hpp:15
Error_t
Definition: hall-switch.hpp:30
Error_t disable()
Disables the sensor.
Definition: hall-switch.cpp:188
Definition: hall-switch.hpp:45
Status_t
Definition: hall-switch.hpp:53
Result_t
Definition: hall-switch.hpp:77
GPIO * output
Definition: hall-switch.hpp:119
virtual void callback()
Interrupt mode callback function.
Definition: hall-switch.cpp:272
Definition: hall-switch.hpp:44
Error_t updateBField()
Updates instance magnetic field value.
Definition: hall-switch.cpp:221
HallSwitch()
Hall Switch Default Constructor.
Definition: hall-switch.cpp:19
void(* CBack_t)(Result_t)
Callback function type for interrupt mode.
Definition: hall-switch.hpp:91
Result_t getBField()
Gets magnetic field.
Definition: hall-switch.cpp:258
Definition: hall-switch.hpp:58
Definition: hall-switch.hpp:80
Error_t deinit()
Deinitializes the hardware interfaces.
Definition: hall-switch.cpp:122
~HallSwitch()
Hall Switch Destructor Disables the sensor:
Definition: hall-switch.cpp:75
Definition: hall-switch.hpp:81
Definition: hall-switch.hpp:68
Definition: hall-switch.hpp:32
Definition: hall-switch.hpp:56
MeasMode_t measMode
Definition: hall-switch.hpp:123
Status_t status
Definition: hall-switch.hpp:118
Result_t bfieldVal
Definition: hall-switch.hpp:120
Definition: hall-switch.hpp:22
Definition: hall-switch.hpp:79
PowerMode_t powerMode
Definition: hall-switch.hpp:126
Error_t enable()
Enables the sensor.
Definition: hall-switch.cpp:157
GPIO * power
Definition: hall-switch.hpp:125
Definition: hall-switch.hpp:69
Definition: hall-switch.hpp:55
Definition: hall-pal-gpio.hpp:20
PowerMode_t
Definition: hall-switch.hpp:42