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 
9 #pragma once
10 
27 #include <stdint.h>
28 #ifdef __cplusplus
29 #include "c11_atomics_compat.hpp"
30 #else
31 #include <stdatomic.h>
32 #endif
33 #include "periph/gpio.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
42 typedef struct {
43  gpio_t gpio;
46 
50 typedef struct {
53 
64 
73 
82 
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
gpio_flank_t
Definition: periph_cpu.h:179
C++ compatibility of default C11 atomics types.
Low-level GPIO peripheral driver interface definitions.
int pulse_counter_init(pulse_counter_t *dev, const pulse_counter_params_t *params)
Initialize a pulse counter device.
void pulse_counter_reset(pulse_counter_t *dev)
Reset pulse counter value.
int16_t pulse_counter_read_with_reset(pulse_counter_t *dev)
Read and reset pulse counter value.
int16_t pulse_counter_read_without_reset(pulse_counter_t *dev)
Read pulse counter value.
Type with the same alignment and size as atomic_uint_least16_t
Parameters needed for device initialization.
Definition: pulse_counter.h:42
gpio_t gpio
GPIO pin that sensor is connected to.
Definition: pulse_counter.h:43
gpio_flank_t gpio_flank
GPIO flank option.
Definition: pulse_counter.h:44
Device descriptor for a pulse counter device.
Definition: pulse_counter.h:50
atomic_uint_least16_t pulse_count
pulse counter
Definition: pulse_counter.h:51