mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-05-04 15:20:16 +00:00
v1.0.1 fix define conflict
This commit is contained in:
parent
a11553c46f
commit
9be22f1b55
22
IR_Decoder.h
22
IR_Decoder.h
@ -1,25 +1,25 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "IR_config.h"
|
#include "IR_config.h"
|
||||||
|
|
||||||
//#define IRDEBUG
|
//#define IR_IRDEBUG
|
||||||
|
|
||||||
#ifdef IRDEBUG
|
#ifdef IRDEBUG
|
||||||
#define wrHigh 3 // Запись HIGH инициирована // green
|
#define IR_wrHigh 3 // Запись HIGH инициирована // green
|
||||||
#define wrLow 4 // Запись LOW инициирована // blue
|
#define IR_wrLow 4 // Запись LOW инициирована // blue
|
||||||
#define writeOp 6 // Операция записи, 1 пульс для 0 и 2 для 1 // orange
|
#define IR_writeOp 6 // Операция записи, 1 пульс для 0 и 2 для 1 // orange
|
||||||
// Исправленные ошибки // purle
|
// Исправленные ошибки // purle
|
||||||
// 1 пульс: fix
|
// 1 пульс: fix
|
||||||
#define errOut 5
|
#define IR_errOut 5
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#define riseTime riseSyncTime //* bitTime */ 893U // TODO: Должно высчитываться медианой
|
#define IR_riseTime riseSyncTime //* bitTime */ 893U // TODO: Должно высчитываться медианой
|
||||||
#define riseTolerance tolerance /* 250U */ // погрешность
|
#define IR_riseTolerance tolerance /* 250U */ // погрешность
|
||||||
#define riseTimeMax (riseTime + riseTolerance)
|
#define IR_riseTimeMax (riseTime + riseTolerance)
|
||||||
#define riseTimeMin (riseTime - riseTolerance)
|
#define IR_riseTimeMin (riseTime - riseTolerance)
|
||||||
#define aroundRise(t) (riseTimeMin < t && t < riseTimeMax)
|
#define IR_aroundRise(t) (riseTimeMin < t && t < riseTimeMax)
|
||||||
#define timeout ((riseTimeMax * 8) + syncBits +1) // us // таймаут в 8 data + 3 sync + 1
|
#define IR_timeout ((riseTimeMax * 8) + syncBits +1) // us // таймаут в 8 data + 3 sync + 1
|
||||||
|
|
||||||
class IR_Encoder;
|
class IR_Encoder;
|
||||||
class IR_Decoder : private IR_FOX {
|
class IR_Decoder : private IR_FOX {
|
||||||
|
42
IR_config.h
42
IR_config.h
@ -60,40 +60,40 @@ msg type:
|
|||||||
/*
|
/*
|
||||||
/////////////////////////////////////////////////////////////////////////////////////*/
|
/////////////////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
#define bytePerPack 3 // колличество байтов в пакете
|
#define IR_bytePerPack 3 // колличество байтов в пакете
|
||||||
#define freeFrec true
|
#define IR_freeFrec true
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#define bitPerByte 8U // Колличество бит в байте
|
#define IR_bitPerByte 8U // Колличество бит в байте
|
||||||
#define addrBytes 2
|
#define IR_addrBytes 2
|
||||||
#define msgBytes 1
|
#define IR_msgBytes 1
|
||||||
#define crcBytes 2
|
#define IR_crcBytes 2
|
||||||
typedef uint16_t crc_t;
|
typedef uint16_t crc_t;
|
||||||
#define poly1 0x31
|
#define IR_poly1 0x31
|
||||||
#define poly2 0x8C
|
#define IR_poly2 0x8C
|
||||||
#define syncBits 3U // количество битов синхронизации
|
#define IR_syncBits 3U // количество битов синхронизации
|
||||||
|
|
||||||
#define dataByteSizeMax (msgBytes + addrBytes + addrBytes + bytePerPack + crcBytes)
|
#define IR_dataByteSizeMax (msgBytes + addrBytes + addrBytes + bytePerPack + crcBytes)
|
||||||
// размер msg в битах // размер короткой посылки в битах
|
// размер msg в битах // размер короткой посылки в битах
|
||||||
#define dataBitSize ((8 + syncBits) * dataByteSizeMax) // размер посылки с данными в битах
|
#define IR_dataBitSize ((8 + syncBits) * dataByteSizeMax) // размер посылки с данными в битах
|
||||||
#define bufferBitSizeMax (dataBitSize) // Размер буффера в битах
|
#define IR_bufferBitSizeMax (dataBitSize) // Размер буффера в битах
|
||||||
|
|
||||||
//const auto x = bufferBitSizeMax;
|
//const auto x = bufferBitSizeMax;
|
||||||
#define preambPulse 3U
|
#define IR_preambPulse 3U
|
||||||
#define preambFronts (preambPulse*2) // количество фронтов преамбулы
|
#define IR_preambFronts (preambPulse*2) // количество фронтов преамбулы
|
||||||
|
|
||||||
#define carrierFrec 38000U // частота несущей
|
#define IR_carrierFrec 38000U // частота несущей
|
||||||
#define carrierPeriod (1000000U/carrierFrec) // период несущей в us
|
#define IR_carrierPeriod (1000000U/carrierFrec) // период несущей в us
|
||||||
|
|
||||||
// В процессе работы значения будут отклонятся в соответствии с предыдущим битом
|
// В процессе работы значения будут отклонятся в соответствии с предыдущим битом
|
||||||
#define bitActiveTakts 25U // длительность активной части бита в тактах
|
#define IR_bitActiveTakts 25U // длительность активной части бита в тактах
|
||||||
#define bitPauseTakts 5U // длительность промежутков в тактах
|
#define IR_bitPauseTakts 5U // длительность промежутков в тактах
|
||||||
|
|
||||||
#define bitTakts (bitActiveTakts+bitPauseTakts*2U) // Общая длительность бита в тактах
|
#define IR_bitTakts (bitActiveTakts+bitPauseTakts*2U) // Общая длительность бита в тактах
|
||||||
#define bitTime (bitTakts*carrierPeriod) // Общая длительность бита
|
#define IR_bitTime (bitTakts*carrierPeriod) // Общая длительность бита
|
||||||
//const auto viewValue = bitTime;
|
//const auto viewValue = bitTime;
|
||||||
#define tolerance 300U
|
#define IR_tolerance 300U
|
||||||
|
|
||||||
class IR_FOX {
|
class IR_FOX {
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user