mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-13 06:32:26 +00:00
389ff92cc1
* Makefile, Scripts: new linter * About: remove ID from IC * Firmware: remove double define for DIVC/DIVR * Scripts: check folder names too. Docker: replace syntax check with make lint. * Reformat Sources and Migrate to new file naming convention * Docker: symlink clang-format-12 to clang-format * Add coding style guide
46 lines
1.2 KiB
C
46 lines
1.2 KiB
C
#pragma once
|
|
#include "irda.h"
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
typedef struct {
|
|
uint32_t min_split_time;
|
|
uint32_t silence_time;
|
|
uint16_t preamble_mark;
|
|
uint16_t preamble_space;
|
|
uint16_t bit1_mark;
|
|
uint16_t bit1_space;
|
|
uint16_t bit0_mark;
|
|
uint16_t bit0_space;
|
|
uint32_t preamble_tolerance;
|
|
uint32_t bit_tolerance;
|
|
} IrdaTimings;
|
|
|
|
typedef struct {
|
|
const char* name;
|
|
uint8_t address_length;
|
|
uint8_t command_length;
|
|
uint32_t frequency;
|
|
float duty_cycle;
|
|
} IrdaProtocolSpecification;
|
|
|
|
typedef const IrdaProtocolSpecification* (*IrdaGetProtocolSpec)(IrdaProtocol protocol);
|
|
|
|
typedef void* (*IrdaAlloc)(void);
|
|
typedef void (*IrdaFree)(void*);
|
|
|
|
typedef void (*IrdaDecoderReset)(void*);
|
|
typedef IrdaMessage* (*IrdaDecode)(void* ctx, bool level, uint32_t duration);
|
|
typedef IrdaMessage* (*IrdaDecoderCheckReady)(void*);
|
|
|
|
typedef void (*IrdaEncoderReset)(void* encoder, const IrdaMessage* message);
|
|
typedef IrdaStatus (*IrdaEncode)(void* encoder, uint32_t* out, bool* polarity);
|
|
|
|
static inline uint8_t reverse(uint8_t value) {
|
|
uint8_t reverse_value = 0;
|
|
for(int i = 0; i < 8; ++i) {
|
|
reverse_value |= (value & (0x01 << i)) ? 1 << (7 - i) : 0;
|
|
}
|
|
|
|
return reverse_value;
|
|
}
|