Loading...
Searching...
No Matches
pulse_reader.h
1#pragma once
2
3#include <stdint.h>
4#include <stdlib.h>
5#include <stdbool.h>
6
7#include <furi_hal_gpio.h>
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13#define PULSE_READER_NO_EDGE (0xFFFFFFFFUL)
14#define PULSE_READER_LOST_EDGE (0xFFFFFFFEUL)
15#define F_TIM2 (64000000UL)
16
20typedef enum {
21 PulseReaderUnit64MHz,
22 PulseReaderUnitPicosecond,
23 PulseReaderUnitNanosecond,
24 PulseReaderUnitMicrosecond,
25} PulseReaderUnit;
26
27/* using an anonymous type */
28typedef struct PulseReader PulseReader;
29
37PulseReader* pulse_reader_alloc(const GpioPin* gpio, uint32_t size);
38
45void pulse_reader_free(PulseReader* signal);
46
54void pulse_reader_start(PulseReader* signal);
55
62void pulse_reader_stop(PulseReader* signal);
63
76uint32_t pulse_reader_receive(PulseReader* signal, int timeout_us);
77
86uint32_t pulse_reader_samples(PulseReader* signal);
87
95void pulse_reader_set_timebase(PulseReader* signal, PulseReaderUnit unit);
96
108void pulse_reader_set_bittime(PulseReader* signal, uint32_t bit_time);
109
118void pulse_reader_set_pull(PulseReader* signal, GpioPull pull);
119
120#ifdef __cplusplus
121}
122#endif
Gpio structure.
Definition furi_hal_gpio.h:161
Definition pulse_reader.c:12