unihall
2.0.0.0
clicks
unihall
lib
include
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 "drv_digital_in.h"
39
40
// -------------------------------------------------------------- PUBLIC MACROS
50
#define UNIHALL_MAP_MIKROBUS( cfg, mikrobus ) \
51
cfg.int_pin= MIKROBUS( mikrobus, MIKROBUS_INT );
52
58
#define UNIHALL_RETVAL uint8_t
59
60
#define UNIHALL_OK 0x00
61
#define UNIHALL_INIT_ERROR 0xFF
62
68
#define UNIHALL_RETVAL uint8_t
69
70
#define UNIHALL_NORTH_POLE_DETECTED 0x00
71
#define UNIHALL_NORTH_POLE_NOT_DETECTED 0x01
72
// End group macro
75
// --------------------------------------------------------------- PUBLIC TYPES
84
typedef
struct
85
{
86
// Input pins
87
88
digital_in_t
int_pin
;
89
90
}
unihall_t
;
91
95
typedef
struct
96
{
97
// Additional gpio pins
98
99
pin_name_t
int_pin
;
100
101
}
unihall_cfg_t
;
102
// End types group
104
// ------------------------------------------------------------------ CONSTANTS // End constants group
113
// ------------------------------------------------------------------ VARIABLES // End variable group
121
// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
122
128
#ifdef __cplusplus
129
extern
"C"
{
130
#endif
131
140
void
unihall_cfg_setup
(
unihall_cfg_t
*cfg );
141
149
UNIHALL_RETVAL
unihall_init
(
unihall_t
*ctx,
unihall_cfg_t
*cfg );
150
165
uint8_t
unihall_detecting_magnetic_fields
(
unihall_t
*ctx );
166
167
168
#ifdef __cplusplus
169
}
170
#endif
171
#endif // _UNIHALL_H_
172
// End public_function group
175
176
// ------------------------------------------------------------------------- END
UNIHALL_RETVAL
#define UNIHALL_RETVAL
Definition:
unihall.h:68
unihall_cfg_t
Click configuration structure definition.
Definition:
unihall.h:95
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:99
unihall_t::int_pin
digital_in_t int_pin
Definition:
unihall.h:88
unihall_t
Click ctx object definition.
Definition:
unihall.h:84
Generated by
1.8.16