Loading...
Searching...
No Matches
infrared.h
1#pragma once
2
3#include <stdbool.h>
4#include <stddef.h>
5#include <stdint.h>
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11#define INFRARED_COMMON_CARRIER_FREQUENCY ((uint32_t)38000)
12#define INFRARED_COMMON_DUTY_CYCLE ((float)0.33)
13
14/* if we want to see split raw signals during bruteforce,
15 * we have to have RX raw timing delay less than TX */
16#define INFRARED_RAW_RX_TIMING_DELAY_US 150000
17#define INFRARED_RAW_TX_TIMING_DELAY_US 180000
18
21
22typedef enum {
23 InfraredProtocolUnknown = -1,
24 InfraredProtocolNEC = 0,
25 InfraredProtocolNECext,
26 InfraredProtocolNEC42,
27 InfraredProtocolNEC42ext,
28 InfraredProtocolSamsung32,
29 InfraredProtocolRC6,
30 InfraredProtocolRC5,
31 InfraredProtocolRC5X,
32 InfraredProtocolSIRC,
33 InfraredProtocolSIRC15,
34 InfraredProtocolSIRC20,
35 InfraredProtocolKaseikyo,
36 InfraredProtocolRCA,
37 InfraredProtocolPioneer,
38 /* Add new protocols here */
39 InfraredProtocolMAX,
40} InfraredProtocol;
41
42typedef struct {
43 InfraredProtocol protocol;
44 uint32_t address;
45 uint32_t command;
46 bool repeat;
48
49typedef enum {
50 InfraredStatusError,
51 InfraredStatusOk,
52 InfraredStatusDone,
53 InfraredStatusReady,
54} InfraredStatus;
55
61InfraredDecoderHandler* infrared_alloc_decoder(void);
62
76const InfraredMessage*
77 infrared_decode(InfraredDecoderHandler* handler, bool level, uint32_t duration);
78
93const InfraredMessage* infrared_check_decoder_ready(InfraredDecoderHandler* handler);
94
100void infrared_free_decoder(InfraredDecoderHandler* handler);
101
107void infrared_reset_decoder(InfraredDecoderHandler* handler);
108
115const char* infrared_get_protocol_name(InfraredProtocol protocol);
116
123InfraredProtocol infrared_get_protocol_by_name(const char* protocol_name);
124
131uint8_t infrared_get_protocol_address_length(InfraredProtocol protocol);
132
139uint8_t infrared_get_protocol_command_length(InfraredProtocol protocol);
140
147bool infrared_is_protocol_valid(InfraredProtocol protocol);
148
154InfraredEncoderHandler* infrared_alloc_encoder(void);
155
161void infrared_free_encoder(InfraredEncoderHandler* handler);
162
178InfraredStatus infrared_encode(InfraredEncoderHandler* handler, uint32_t* duration, bool* level);
179
188void infrared_reset_encoder(InfraredEncoderHandler* handler, const InfraredMessage* message);
189
197uint32_t infrared_get_protocol_frequency(InfraredProtocol protocol);
198
206float infrared_get_protocol_duty_cycle(InfraredProtocol protocol);
207
215size_t infrared_get_protocol_min_repeat_count(InfraredProtocol protocol);
216
217#ifdef __cplusplus
218}
219#endif
Definition infrared.c:32
Definition infrared.c:36
Definition infrared.h:42