pulse_counter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 UC Berkeley
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
25 #ifndef PULSE_COUNTER_H
26 #define PULSE_COUNTER_H
27 
28 #include <stdint.h>
29 #ifdef __cplusplus
30 #include "c11_atomics_compat.hpp"
31 #else
32 #include <stdatomic.h>
33 #endif
34 #include "periph/gpio.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
43 typedef struct {
44  gpio_t gpio;
47 
51 typedef struct {
54 
65 
74 
83 
90 
91 #ifdef __cplusplus
92 }
93 #endif
94 
95 #endif /* PULSE_COUNTER_H */
96 
pulse_counter_read_without_reset
int16_t pulse_counter_read_without_reset(pulse_counter_t *dev)
Read pulse counter value.
atomic_uint_least16_t
Type with the same alignment and size as atomic_uint_least16_t
Definition: c11_atomics_compat.hpp:226
pulse_counter_params_t::gpio
gpio_t gpio
GPIO pin that sensor is connected to.
Definition: pulse_counter.h:44
pulse_counter_params_t
Parameters needed for device initialization.
Definition: pulse_counter.h:43
pulse_counter_params_t::gpio_flank
gpio_flank_t gpio_flank
GPIO flank option.
Definition: pulse_counter.h:45
pulse_counter_t::pulse_count
atomic_uint_least16_t pulse_count
pulse counter
Definition: pulse_counter.h:52
pulse_counter_t
Device descriptor for a pulse counter device.
Definition: pulse_counter.h:51
gpio_flank_t
gpio_flank_t
Definition: periph_cpu.h:80
pulse_counter_init
int pulse_counter_init(pulse_counter_t *dev, const pulse_counter_params_t *params)
Initialize a pulse counter device.
c11_atomics_compat.hpp
C++ compatibility of default C11 atomics types.
pulse_counter_reset
void pulse_counter_reset(pulse_counter_t *dev)
Reset pulse counter value.
gpio.h
Low-level GPIO peripheral driver interface definitions.
pulse_counter_read_with_reset
int16_t pulse_counter_read_with_reset(pulse_counter_t *dev)
Read and reset pulse counter value.