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
38#include "drv_digital_in.h"
39
40// -------------------------------------------------------------- PUBLIC MACROS
50#define PEDOMETER_MAP_MIKROBUS( cfg, mikrobus ) \
51 cfg.int_pin= MIKROBUS( mikrobus, MIKROBUS_INT );
58#define PEDOMETER_RETVAL uint8_t
59
60#define PEDOMETER_OK 0x00
61#define PEDOMETER_INIT_ERROR 0xFF
68#define PEDOMETER_NEW_STEP_DETECTED 0x01
69#define PEDOMETER_NO_STEP_DETECTED 0x00 // End group macro
73// --------------------------------------------------------------- PUBLIC TYPES
82typedef struct
83{
84
85 // Input pins
86
87 digital_in_t int_pin;
88 int16_t step_counter;
89
90
92
96typedef struct
97{
98 // Additional gpio pins
99
100 pin_name_t int_pin;
102
104 // End types group
106
107// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
108
114#ifdef __cplusplus
115extern "C"{
116#endif
117
127
136
145
155void pedometer_reset_step_counter ( pedometer_t *ctx, uint32_t new_cnt );
156
166
176
186
187#ifdef __cplusplus
188}
189#endif
190#endif // _PEDOMETER_H_
191 // End public_function group
194
195// ------------------------------------------------------------------------- END
#define PEDOMETER_RETVAL
Definition: pedometer.h:58
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:97
int16_t dev_step_counter
Definition: pedometer.h:101
pin_name_t int_pin
Definition: pedometer.h:100
Click ctx object definition.
Definition: pedometer.h:83
int16_t step_counter
Definition: pedometer.h:88
digital_in_t int_pin
Definition: pedometer.h:87