Loading...
Searching...
No Matches
infrared_i.h
1#pragma once
2#include "infrared.h"
3#include <stddef.h>
4#include <stdint.h>
5
6typedef struct {
7 uint32_t min_split_time;
8 uint32_t silence_time;
9 uint16_t preamble_mark;
10 uint16_t preamble_space;
11 uint16_t bit1_mark;
12 uint16_t bit1_space;
13 uint16_t bit0_mark;
14 uint16_t bit0_space;
15 uint32_t preamble_tolerance;
16 uint32_t bit_tolerance;
18
19typedef struct {
20 const char* name;
21 uint8_t address_length;
22 uint8_t command_length;
23 uint32_t frequency;
24 float duty_cycle;
25 size_t repeat_count;
27
28typedef const InfraredProtocolVariant* (*InfraredGetProtocolVariant)(InfraredProtocol protocol);
29
30typedef void* (*InfraredAlloc)(void);
31typedef void (*InfraredFree)(void*);
32
33typedef void (*InfraredDecoderReset)(void*);
34typedef InfraredMessage* (*InfraredDecode)(void* ctx, bool level, uint32_t duration);
35typedef InfraredMessage* (*InfraredDecoderCheckReady)(void*);
36
37typedef void (*InfraredEncoderReset)(void* encoder, const InfraredMessage* message);
38typedef InfraredStatus (*InfraredEncode)(void* encoder, uint32_t* out, bool* polarity);
39
40static inline uint8_t reverse(uint8_t value) {
41 uint8_t reverse_value = 0;
42 for(int i = 0; i < 8; ++i) {
43 reverse_value |= (value & (0x01 << i)) ? 1 << (7 - i) : 0;
44 }
45
46 return reverse_value;
47}
Definition infrared.h:42
Definition infrared_i.h:19
Definition infrared_i.h:6