force2
2.0.0.0
clicks
force2
lib
include
force2.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 FORCE2_H
36
#define FORCE2_H
37
38
#include "drv_digital_out.h"
39
#include "drv_digital_in.h"
40
#include "drv_analog_in.h"
41
42
// -------------------------------------------------------------- PUBLIC MACROS
43
53
#define FORCE2_MAP_MIKROBUS( cfg, mikrobus ) \
54
cfg.an_pin = MIKROBUS( mikrobus, MIKROBUS_AN )
55
61
#define FORCE2_RETVAL uint8_t
62
63
#define FORCE2_OK 0x00
64
#define FORCE2_INIT_ERROR 0xFF
65
// End group macro
68
// --------------------------------------------------------------- PUBLIC TYPES
77
typedef
uint16_t
force2_data_t
;
78
82
typedef
struct
83
{
84
// Modules
85
86
analog_in_t
adc
;
87
88
}
force2_t
;
89
93
typedef
struct
94
{
95
// Communication gpio pins
96
97
pin_name_t
an_pin
;
98
99
// static variable
100
101
analog_in_resolution_t
resolution
;
// Resolution
102
float
vref
;
// VRef
103
104
}
force2_cfg_t
;
105
// End types group
107
// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
108
114
#ifdef __cplusplus
115
extern
"C"
{
116
#endif
117
126
void
force2_cfg_setup
(
force2_cfg_t
*cfg );
127
136
FORCE2_RETVAL
force2_init
(
force2_t
*ctx,
force2_cfg_t
*cfg );
137
146
force2_data_t
force2_generic_read
(
force2_t
*ctx );
147
148
149
#ifdef __cplusplus
150
}
151
#endif
152
#endif // _FORCE2_H_
153
// End public_function group
156
157
// ------------------------------------------------------------------------ END
force2_data_t
uint16_t force2_data_t
Analog data type.
Definition:
force2.h:77
force2_cfg_setup
void force2_cfg_setup(force2_cfg_t *cfg)
Config Object Initialization function.
force2_cfg_t
Click configuration structure definition.
Definition:
force2.h:93
force2_init
FORCE2_RETVAL force2_init(force2_t *ctx, force2_cfg_t *cfg)
Initialization function.
force2_cfg_t::an_pin
pin_name_t an_pin
Definition:
force2.h:97
FORCE2_RETVAL
#define FORCE2_RETVAL
Definition:
force2.h:61
force2_t::adc
analog_in_t adc
Definition:
force2.h:86
force2_generic_read
force2_data_t force2_generic_read(force2_t *ctx)
Generic read function.
force2_t
Click ctx object definition.
Definition:
force2.h:82
force2_cfg_t::resolution
analog_in_resolution_t resolution
Definition:
force2.h:101
force2_cfg_t::vref
float vref
Definition:
force2.h:102
Generated by
1.8.16