mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-05-04 15:20:16 +00:00
timer ini to static func
This commit is contained in:
parent
d065c7a037
commit
aedbe11af3
12
IR_Encoder.h
12
IR_Encoder.h
@ -23,6 +23,18 @@ public:
|
|||||||
/// @param decPair Приёмник, для которого отключается приём в момент передачи передатчиком
|
/// @param decPair Приёмник, для которого отключается приём в момент передачи передатчиком
|
||||||
IR_Encoder(uint16_t addr, uint8_t pin, IR_Decoder* decPair = nullptr);
|
IR_Encoder(uint16_t addr, uint8_t pin, IR_Decoder* decPair = nullptr);
|
||||||
|
|
||||||
|
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);
|
void IR_Encoder::setBlindDecoders(IR_Decoder* decoders [], uint8_t count);
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void sendData(uint16_t addrTo, T& data, bool needAccept = false);
|
void sendData(uint16_t addrTo, T& data, bool needAccept = false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user