unihall  2.0.0.0
unihall.h
Go to the documentation of this file.
1 /*
2  * MikroSDK - MikroE Software Development Kit
3  * Copyright© 2020 MikroElektronika d.o.o.
4  *
5  * Permission is hereby granted, free of charge, to any person
6  * obtaining a copy of this software and associated documentation
7  * files (the "Software"), to deal in the Software without restriction,
8  * including without limitation the rights to use, copy, modify, merge,
9  * publish, distribute, sublicense, and/or sell copies of the Software,
10  * and to permit persons to whom the Software is furnished to do so,
11  * subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22  * OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
33 // ----------------------------------------------------------------------------
34 
35 #ifndef UNIHALL_H
36 #define UNIHALL_H
37 
42 #ifdef PREINIT_SUPPORTED
43 #include "preinit.h"
44 #endif
45 
46 #ifdef MikroCCoreVersion
47  #if MikroCCoreVersion >= 1
48  #include "delays.h"
49  #endif
50 #endif
51 
52 #include "drv_digital_in.h"
53 
54 // -------------------------------------------------------------- PUBLIC MACROS
64 #define UNIHALL_MAP_MIKROBUS( cfg, mikrobus ) \
65  cfg.int_pin= MIKROBUS( mikrobus, MIKROBUS_INT );
66 
72 #define UNIHALL_RETVAL uint8_t
73 
74 #define UNIHALL_OK 0x00
75 #define UNIHALL_INIT_ERROR 0xFF
76 
82 #define UNIHALL_RETVAL uint8_t
83 
84 #define UNIHALL_NORTH_POLE_DETECTED 0x00
85 #define UNIHALL_NORTH_POLE_NOT_DETECTED 0x01
86  // End group macro
89 // --------------------------------------------------------------- PUBLIC TYPES
98 typedef struct
99 {
100  // Input pins
101 
102  digital_in_t int_pin;
103 
104 } unihall_t;
105 
109 typedef struct
110 {
111  // Additional gpio pins
112 
113  pin_name_t int_pin;
114 
115 } unihall_cfg_t;
116  // End types group
118 // ------------------------------------------------------------------ CONSTANTS // End constants group
127 // ------------------------------------------------------------------ VARIABLES // End variable group
135 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
136 
142 #ifdef __cplusplus
143 extern "C"{
144 #endif
145 
155 
164 
180 
181 
182 #ifdef __cplusplus
183 }
184 #endif
185 #endif // _UNIHALL_H_
186  // End public_function group
189 
190 // ------------------------------------------------------------------------- END
UNIHALL_RETVAL
#define UNIHALL_RETVAL
Definition: unihall.h:82
unihall_cfg_t
Click configuration structure definition.
Definition: unihall.h:110
unihall_cfg_setup
void unihall_cfg_setup(unihall_cfg_t *cfg)
Config Object Initialization function.
unihall_detecting_magnetic_fields
uint8_t unihall_detecting_magnetic_fields(unihall_t *ctx)
Detecting north pole magnetic fields status function.
unihall_init
UNIHALL_RETVAL unihall_init(unihall_t *ctx, unihall_cfg_t *cfg)
Initialization function.
unihall_cfg_t::int_pin
pin_name_t int_pin
Definition: unihall.h:113
unihall_t::int_pin
digital_in_t int_pin
Definition: unihall.h:102
unihall_t
Click ctx object definition.
Definition: unihall.h:99