tmrmixsens 2.0.0.0
tmrmixsens.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
35#ifndef TMRMIXSENS_H
36#define TMRMIXSENS_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_out.h"
53#include "drv_digital_in.h"
54#include "drv_analog_in.h"
55
56// -------------------------------------------------------------- PUBLIC MACROS
57
67#define TMRMIXSENS_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.an_pin = MIKROBUS( mikrobus, MIKROBUS_AN ); \
69 cfg.omn = MIKROBUS( mikrobus, MIKROBUS_RST ); \
70 cfg.bi = MIKROBUS( mikrobus, MIKROBUS_CS )
71
78#define TMRMIXSENS_RETVAL uint8_t
79
80#define TMRMIXSENS_OK 0x00
81#define TMRMIXSENS_INIT_ERROR 0xFF
88#define TMRMIXSENS_SOUTH_POLE 0
89#define TMRMIXSENS_NORTH_POLE 1
92 // End group macro
93// --------------------------------------------------------------- PUBLIC TYPES
102typedef uint16_t tmrmixsens_data_t;
103
107typedef struct
108{
109 // Input pins
110
111 digital_in_t omn;
112 digital_in_t bi;
113
114 // Modules
115
116 analog_in_t adc;
117
119
123typedef struct
124{
125 // Communication gpio pins
126
127 pin_name_t an_pin;
128
129 // Additional gpio pins
130
131 pin_name_t omn;
132 pin_name_t bi;
133
134 // static variable
135
136 analog_in_resolution_t resolution; // Resolution
137 float vref; // VRef
138
140
141 // End types group
142// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
143
149#ifdef __cplusplus
150extern "C"{
151#endif
152
162
172
182
198
214
215#ifdef __cplusplus
216}
217#endif
218#endif // _TMRMIXSENS_H_
219
220 // End public_function group
222
223// ------------------------------------------------------------------------ END
#define TMRMIXSENS_RETVAL
Definition tmrmixsens.h:78
uint8_t tmrmixsens_get_omnipolar(tmrmixsens_t *ctx)
Get state of the omnipolar ( OMN ) pin function.
tmrmixsens_data_t tmrmixsens_generic_read(tmrmixsens_t *ctx)
Generic read function.
void tmrmixsens_cfg_setup(tmrmixsens_cfg_t *cfg)
Config Object Initialization function.
uint8_t tmrmixsens_get_bipolar(tmrmixsens_t *ctx)
Get state of the bipolar ( BI ) pin function.
TMRMIXSENS_RETVAL tmrmixsens_init(tmrmixsens_t *ctx, tmrmixsens_cfg_t *cfg)
Initialization function.
uint16_t tmrmixsens_data_t
Analog data type.
Definition tmrmixsens.h:102
Click configuration structure definition.
Definition tmrmixsens.h:124
analog_in_resolution_t resolution
Definition tmrmixsens.h:136
pin_name_t bi
Definition tmrmixsens.h:132
float vref
Definition tmrmixsens.h:137
pin_name_t an_pin
Definition tmrmixsens.h:127
pin_name_t omn
Definition tmrmixsens.h:131
Click ctx object definition.
Definition tmrmixsens.h:108
digital_in_t bi
Definition tmrmixsens.h:112
digital_in_t omn
Definition tmrmixsens.h:111
analog_in_t adc
Definition tmrmixsens.h:116