Hall Switch 2.1.0
C++ library of Infineon single Hall-effect switch family for magnetic sensing applications
 
Loading...
Searching...
No Matches
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
31 {
32 OK = 0,
35 };
43 {
44 MAIN = 1,
45 SWITCH = 2,
46 };
54 {
56 INITED = 1,
59 };
67 {
68 POLLING = 1,
70 };
78 {
82 };
91 typedef void (*CBack_t)(Result_t);
92
96 class Hall_GPIO;
97
101 class Interrupt;
102
103 HallSwitch ();
105 CBack_t cBack = NULL,
106 Hall_GPIO *power = NULL);
107 ~HallSwitch ();
108 Error_t init ();
109 Error_t deinit ();
110 Error_t enable ();
111 Error_t disable ();
115
116 protected:
117
128 virtual void callback ();
129
130};
131
134#endif
Definition hall-pal-gpio.hpp:21
Definition hall-switch-int.hpp:16
Definition hall-switch.hpp:23
Status_t status
Definition hall-switch.hpp:118
Error_t init()
Initializes the hardware interfaces.
Definition hall-switch.cpp:90
Error_t updateBField()
Updates instance magnetic field value.
Definition hall-switch.cpp:221
CBack_t cBack
Definition hall-switch.hpp:122
HallSwitch()
Hall Switch Default Constructor.
Definition hall-switch.cpp:19
Error_t disable()
Disables the sensor.
Definition hall-switch.cpp:188
Result_t getBField()
Gets magnetic field.
Definition hall-switch.cpp:258
virtual void callback()
Interrupt mode callback function.
Definition hall-switch.cpp:272
Result_t
Definition hall-switch.hpp:78
@ B_FIELD_ON
Definition hall-switch.hpp:81
@ B_FIELD_OFF
Definition hall-switch.hpp:80
@ B_FIELD_UNDEF
Definition hall-switch.hpp:79
Status_t getStatus()
Gets the sensor status.
Definition hall-switch.cpp:241
Status_t
Definition hall-switch.hpp:54
@ UNINITED
Definition hall-switch.hpp:55
@ POWER_ON
Definition hall-switch.hpp:57
@ INITED
Definition hall-switch.hpp:56
@ POWER_OFF
Definition hall-switch.hpp:58
Error_t
Definition hall-switch.hpp:31
@ CONF_ERROR
Definition hall-switch.hpp:34
@ OK
Definition hall-switch.hpp:32
@ INTF_ERROR
Definition hall-switch.hpp:33
Error_t enable()
Enables the sensor.
Definition hall-switch.cpp:157
~HallSwitch()
Hall Switch Destructor Disables the sensor:
Definition hall-switch.cpp:75
PowerMode_t
Definition hall-switch.hpp:43
@ SWITCH
Definition hall-switch.hpp:45
@ MAIN
Definition hall-switch.hpp:44
Hall_GPIO * power
Definition hall-switch.hpp:125
Result_t bfieldVal
Definition hall-switch.hpp:120
void(* CBack_t)(Result_t)
Callback function type for interrupt mode.
Definition hall-switch.hpp:91
MeasMode_t
Definition hall-switch.hpp:67
@ INTERRUPT
Definition hall-switch.hpp:69
@ POLLING
Definition hall-switch.hpp:68
Error_t deinit()
Deinitializes the hardware interfaces.
Definition hall-switch.cpp:122
PowerMode_t powerMode
Definition hall-switch.hpp:126
MeasMode_t measMode
Definition hall-switch.hpp:123
Hall_GPIO * output
Definition hall-switch.hpp:119