infrared
infrared copied to clipboard
Unexpected Sender Behavior When Trying to Send the Same Received Signal
I have written a code that receives IR signals using MultiReceiver's event_iter and then sends the same received commands using transmitter.load:
#[task(binds = EXTI9_5, local = [mono, receiver,transmitter])]
fn button_click4(mut ctx: button_click4::Context) {
unsafe {
static mut LAST: Option<Instant> = None;
let now = ctx.local.mono.now();
if let Some(dt) = LAST.map(|i| i.elapsed()) {
if let Ok(cmds) = ctx.local.receiver.event_iter(dt) {
for cmd in cmds {
if let MultiReceiverCommand::Nec(c) = cmd {
hprintln!("cmd: {:?}",c);
ctx.local.transmitter.tick();
ctx.local.transmitter.load::<Nec>(&c);
}
}
}
}
LAST.replace(now);
}
ctx.local.receiver.pin().clear_interrupt_pending_bit();
}
But the signal that is generated by the sender is completely different from the signal that is being sent to the receiver when I check them using oscilloscope.
This is the signal that I send to my receiver:
Which causes the sender to start making these signals continuously:
Until the second time that I send that same signal to my receiver and then the sender stops signaling.