mirror of
https://github.com/Show-maket/IR-protocol.git
synced 2025-05-04 07:10:16 +00:00
begin()
This commit is contained in:
parent
90c41cfe2b
commit
0471b8cc89
@ -37,6 +37,25 @@ IR_Encoder::IR_Encoder(uint8_t pin, uint16_t addr, IR_DecoderRaw *decPair, bool
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void WEAK EncoderISR()
|
||||||
|
{
|
||||||
|
IR_Encoder::isr();
|
||||||
|
}
|
||||||
|
|
||||||
|
HardwareTimer IR_Encoder::IR_Timer;
|
||||||
|
|
||||||
|
inline HardwareTimer* IR_Encoder::get_IR_Timer(){return &IR_Encoder::IR_Timer;}
|
||||||
|
|
||||||
|
void IR_Encoder::begin(HardwareTimer timer, uint8_t channel, IRQn_Type IRQn){
|
||||||
|
IR_Timer = timer;
|
||||||
|
IR_Timer.setOverflow(carrierFrec * 2, HERTZ_FORMAT);
|
||||||
|
IR_Timer.attachInterrupt(channel, EncoderISR);
|
||||||
|
NVIC_SetPriority(IRQn, 0);
|
||||||
|
IR_Timer.resume();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void IR_Encoder::enable()
|
void IR_Encoder::enable()
|
||||||
{
|
{
|
||||||
auto &enc_list = get_enc_list();
|
auto &enc_list = get_enc_list();
|
||||||
|
@ -9,6 +9,7 @@ class IR_Encoder : public IR_FOX
|
|||||||
friend IR_DecoderRaw;
|
friend IR_DecoderRaw;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static HardwareTimer IR_Timer;
|
||||||
private:
|
private:
|
||||||
// uint16_t id; /// @brief Адрес передатчика
|
// uint16_t id; /// @brief Адрес передатчика
|
||||||
public:
|
public:
|
||||||
@ -18,6 +19,8 @@ public:
|
|||||||
/// @param decPair Приёмник, для которого отключается приём в момент передачи передатчиком
|
/// @param decPair Приёмник, для которого отключается приём в момент передачи передатчиком
|
||||||
IR_Encoder(uint8_t pin, uint16_t addr = 0, IR_DecoderRaw *decPair = nullptr, bool autoHandle = true);
|
IR_Encoder(uint8_t pin, uint16_t addr = 0, IR_DecoderRaw *decPair = nullptr, bool autoHandle = true);
|
||||||
static void isr();
|
static void isr();
|
||||||
|
static void begin(HardwareTimer IR_Timer, uint8_t channel, IRQn_Type IRQn);
|
||||||
|
static HardwareTimer* get_IR_Timer();
|
||||||
|
|
||||||
void enable();
|
void enable();
|
||||||
void disable();
|
void disable();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user