This commit is contained in:
2024-04-23 13:35:49 +03:00
parent 06d27f2590
commit e951111c53
11 changed files with 443 additions and 502 deletions

View File

@ -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);