mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-06-28 05:09:40 +00:00
refactor
This commit is contained in:
35
IR_Encoder.h
35
IR_Encoder.h
@ -11,40 +11,14 @@ class IR_Encoder : IR_FOX
|
||||
public:
|
||||
private:
|
||||
uint16_t id; /// @brief Адрес передатчика
|
||||
|
||||
uint8_t pin;
|
||||
public:
|
||||
/// @brief Класс передатчика
|
||||
/// @param addr Адрес передатчика
|
||||
/// @param pin Вывод передатчика
|
||||
/// @param tune Подстройка несущей частоты
|
||||
/// @param decPair Приёмник, для которого отключается приём в момент передачи передатчиком
|
||||
IR_Encoder(uint16_t addr, IR_DecoderRaw *decPair = nullptr);
|
||||
|
||||
// static void timerSetup()
|
||||
// {
|
||||
// // // TIMER2 Ini
|
||||
// // uint8_t oldSREG = SREG; // Save global interupts settings
|
||||
// // cli();
|
||||
// // // DDRB |= (1 << PORTB3); //OC2A (17)
|
||||
// // TCCR2A = 0;
|
||||
// // TCCR2B = 0;
|
||||
|
||||
// // // TCCR2A |= (1 << COM2A0); //Переключение состояния
|
||||
|
||||
// // TCCR2A |= (1 << WGM21); // Clear Timer On Compare (Сброс по совпадению)
|
||||
// // TCCR2B |= (1 << CS20); // Предделитель 1
|
||||
// // TIMSK2 |= (1 << OCIE2A); // Прерывание по совпадению
|
||||
|
||||
// // OCR2A = /* 465 */ ((F_CPU / (38000 * 2)) - 2); // 38кГц
|
||||
|
||||
// // SREG = oldSREG; // Return interrupt settings
|
||||
|
||||
|
||||
// }
|
||||
// static void timerOFFSetup()
|
||||
// {
|
||||
// TIMSK2 &= ~(1 << OCIE2A); // Прерывание по совпадению выкл
|
||||
// }
|
||||
IR_Encoder(uint8_t pin, uint16_t addr, IR_DecoderRaw *decPair = nullptr);
|
||||
static void isr();
|
||||
|
||||
void setBlindDecoders(IR_DecoderRaw *decoders[], uint8_t count);
|
||||
void rawSend(uint8_t *ptr, uint8_t len);
|
||||
@ -59,13 +33,14 @@ public:
|
||||
void sendBack(uint8_t *data = nullptr, uint8_t len = 0);
|
||||
void sendBackTo(uint16_t addrTo, uint8_t *data = nullptr, uint8_t len = 0);
|
||||
|
||||
void isr();
|
||||
|
||||
~IR_Encoder();
|
||||
volatile bool ir_out_virtual;
|
||||
|
||||
private:
|
||||
static std::list<IR_Encoder*>& get_enc_list();
|
||||
void _sendBack(bool isAdressed, uint16_t addrTo, uint8_t *data, uint8_t len);
|
||||
void _isr();
|
||||
|
||||
void setDecoder_isSending();
|
||||
void sendByte(uint8_t byte, bool *prev, bool LOW_FIRST);
|
||||
|
Reference in New Issue
Block a user