Loading...
Searching...
No Matches
signal_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
13typedef enum {
14 SignalReaderEventTypeHalfBufferFilled,
15 SignalReaderEventTypeFullBufferFilled,
16} SignalReaderEventType;
17
18typedef struct {
19 uint8_t* data;
20 size_t len;
22
23typedef struct {
24 SignalReaderEventType type;
27
28typedef enum {
29 SignalReaderTimeUnit64Mhz,
30} SignalReaderTimeUnit;
31
32typedef enum {
33 SignalReaderPolarityNormal,
34 SignalReaderPolarityInverted,
35} SignalReaderPolarity;
36
37typedef enum {
38 SignalReaderTriggerNone,
39 SignalReaderTriggerRisingFallingEdge,
40} SignalReaderTrigger;
41
42typedef void (*SignalReaderCallback)(SignalReaderEvent event, void* context);
43
44typedef struct SignalReader SignalReader;
45
46SignalReader* signal_reader_alloc(const GpioPin* gpio_pin, uint32_t size);
47
48void signal_reader_free(SignalReader* instance);
49
50void signal_reader_set_pull(SignalReader* instance, GpioPull pull);
51
52void signal_reader_set_polarity(SignalReader* instance, SignalReaderPolarity polarity);
53
54void signal_reader_set_sample_rate(
55 SignalReader* instance,
56 SignalReaderTimeUnit time_unit,
57 uint32_t time);
58
59void signal_reader_set_trigger(SignalReader* instance, SignalReaderTrigger trigger);
60
61void signal_reader_start(SignalReader* instance, SignalReaderCallback callback, void* context);
62
63void signal_reader_stop(SignalReader* instance);
64
65#ifdef __cplusplus
66}
67#endif
Gpio structure.
Definition furi_hal_gpio.h:161
Definition signal_reader.h:18
Definition signal_reader.h:23
Definition signal_reader.c:31