Fixed procedure for sending IrDA commands, disabled interrupts for better stability (#329)

* Disable irq when send command
This commit is contained in:
DrZlo13
2021-02-09 21:21:05 +10:00
committed by GitHub
parent 446ba55b08
commit 5dbe2983aa
3 changed files with 14 additions and 2 deletions

View File

@@ -37,10 +37,17 @@ void ir_nec_send(uint16_t addr, uint8_t data) {
// and I dont know if this is my fault or a feature of the analyzer
// TODO: check the dictionary and check with a known remote
uint8_t nec_packet[4] = {~(uint8_t)addr, ~(uint8_t)(addr >> 8), ~(uint8_t)data, data};
osKernelLock();
__disable_irq();
ir_nec_preambula();
ir_nec_send_byte(nec_packet[0]);
ir_nec_send_byte(nec_packet[1]);
ir_nec_send_byte(nec_packet[2]);
ir_nec_send_byte(nec_packet[3]);
ir_nec_send_bit(1);
__enable_irq();
osKernelUnlock();
}