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 
38 #include "mikrosdk_version.h"
39 
40 #ifdef __GNUC__
41 #if mikroSDK_GET_VERSION < 20800ul
42 #include "rcu_delays.h"
43 #else
44 #include "delays.h"
45 #endif
46 #endif
47 
48 #include "drv_digital_in.h"
49 
50 // -------------------------------------------------------------- PUBLIC MACROS
60 #define UNIHALL_MAP_MIKROBUS( cfg, mikrobus ) \
61  cfg.int_pin= MIKROBUS( mikrobus, MIKROBUS_INT );
62 
68 #define UNIHALL_RETVAL uint8_t
69 
70 #define UNIHALL_OK 0x00
71 #define UNIHALL_INIT_ERROR 0xFF
72 
78 #define UNIHALL_RETVAL uint8_t
79 
80 #define UNIHALL_NORTH_POLE_DETECTED 0x00
81 #define UNIHALL_NORTH_POLE_NOT_DETECTED 0x01
82  // End group macro
85 // --------------------------------------------------------------- PUBLIC TYPES
94 typedef struct
95 {
96  // Input pins
97 
98  digital_in_t int_pin;
99 
100 } unihall_t;
101 
105 typedef struct
106 {
107  // Additional gpio pins
108 
109  pin_name_t int_pin;
110 
111 } unihall_cfg_t;
112  // End types group
114 // ------------------------------------------------------------------ CONSTANTS // End constants group
123 // ------------------------------------------------------------------ VARIABLES // End variable group
131 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
132 
138 #ifdef __cplusplus
139 extern "C"{
140 #endif
141 
151 
160 
176 
177 
178 #ifdef __cplusplus
179 }
180 #endif
181 #endif // _UNIHALL_H_
182  // End public_function group
185 
186 // ------------------------------------------------------------------------- END
UNIHALL_RETVAL
#define UNIHALL_RETVAL
Definition: unihall.h:78
unihall_cfg_t
Click configuration structure definition.
Definition: unihall.h:106
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:109
unihall_t::int_pin
digital_in_t int_pin
Definition: unihall.h:98
unihall_t
Click ctx object definition.
Definition: unihall.h:95