pedometer 2.0.0.0
pedometer.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 PEDOMETER_H
36#define PEDOMETER_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 PEDOMETER_MAP_MIKROBUS( cfg, mikrobus ) \
65 cfg.int_pin= MIKROBUS( mikrobus, MIKROBUS_INT );
72#define PEDOMETER_RETVAL uint8_t
73
74#define PEDOMETER_OK 0x00
75#define PEDOMETER_INIT_ERROR 0xFF
82#define PEDOMETER_NEW_STEP_DETECTED 0x01
83#define PEDOMETER_NO_STEP_DETECTED 0x00
86 // End group macro
87// --------------------------------------------------------------- PUBLIC TYPES
96typedef struct
97{
98
99 // Input pins
100
101 digital_in_t int_pin;
103
104
106
110typedef struct
111{
112 // Additional gpio pins
113
114 pin_name_t int_pin;
116
118
119 // End types group
120
121// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
122
128#ifdef __cplusplus
129extern "C"{
130#endif
131
141
150
159
169void pedometer_reset_step_counter ( pedometer_t *ctx, uint32_t new_cnt );
170
180
190
200
201#ifdef __cplusplus
202}
203#endif
204#endif // _PEDOMETER_H_
205
206 // End public_function group
208
209// ------------------------------------------------------------------------- END
#define PEDOMETER_RETVAL
Definition pedometer.h:72
uint8_t pedometer_get_interrupt_state(pedometer_t *ctx)
Functions for get Interrupt state on the INT pin.
void pedometer_reset_step_counter(pedometer_t *ctx, uint32_t new_cnt)
Functions for reset Step counter.
void pedometer_default_cfg(pedometer_t *ctx)
Click Default Configuration function.
PEDOMETER_RETVAL pedometer_init(pedometer_t *ctx, pedometer_cfg_t *cfg)
Initialization function.
void pedometer_cfg_setup(pedometer_cfg_t *cfg)
Config Object Initialization function.
uint8_t pedometer_process(pedometer_t *ctx)
Pedometer process.
uint32_t pedometer_get_step_counter(pedometer_t *ctx)
Functions for get step counter.
Click configuration structure definition.
Definition pedometer.h:111
int16_t dev_step_counter
Definition pedometer.h:115
pin_name_t int_pin
Definition pedometer.h:114
Click ctx object definition.
Definition pedometer.h:97
int16_t step_counter
Definition pedometer.h:102
digital_in_t int_pin
Definition pedometer.h:101