[FL-1616] RFID: fix HID emulation (#610)

* Rfid: fixed HID emulation by adding zero pulse every 4 bits
* Rfid: HID emulation fixed with DSP based FSK oscillator.
This commit is contained in:
SG
2021-07-30 21:12:36 +10:00
committed by GitHub
parent e9e29e0e0c
commit fb80f9537f
5 changed files with 73 additions and 37 deletions

View File

@@ -0,0 +1,20 @@
#include "osc-fsk.h"
OscFSK::OscFSK(uint16_t _freq_low, uint16_t _freq_hi, uint16_t _osc_phase_max)
: freq{_freq_low, _freq_hi}
, osc_phase_max(_osc_phase_max) {
osc_phase_current = 0;
}
bool OscFSK::next(bool bit, uint16_t* period) {
bool advance = false;
*period = freq[bit];
osc_phase_current += *period;
if(osc_phase_current > osc_phase_max) {
advance = true;
osc_phase_current -= osc_phase_max;
}
return advance;
}