timer ini to static func

This commit is contained in:
DashyFox 2024-02-13 15:36:21 +03:00
parent d065c7a037
commit aedbe11af3

View File

@ -23,7 +23,19 @@ public:
/// @param decPair Приёмник, для которого отключается приём в момент передачи передатчиком
IR_Encoder(uint16_t addr, uint8_t pin, IR_Decoder* decPair = nullptr);
void IR_Encoder::setBlindDecoders(IR_Decoder* decoders[], uint8_t count);
static void timerSetup() {
// TIMER2 Ini
uint8_t oldSREG = SREG; // Save global interupts settings
cli();
TCCR2A = (1 << WGM21); // Clear Timer On Compare (Сброс по совпадению)
TCCR2B = (1 << CS20); // Предделитель 1
TIMSK2 |= (1 << OCIE2A); // Прерывание по совпадению
OCR2A = 465/* ((F_CPU / 38000) - 1) */; //38кГц
SREG = oldSREG; // Return interrupt settings
}
void IR_Encoder::setBlindDecoders(IR_Decoder* decoders [], uint8_t count);
template<typename T>
void sendData(uint16_t addrTo, T& data, bool needAccept = false);
void sendData(uint16_t addrTo, uint8_t* data, uint8_t len, bool needAccept = false);