Naming and coding style convention, new linter tool. (#945)
* Makefile, Scripts: new linter * About: remove ID from IC * Firmware: remove double define for DIVC/DIVR * Scripts: check folder names too. Docker: replace syntax check with make lint. * Reformat Sources and Migrate to new file naming convention * Docker: symlink clang-format-12 to clang-format * Add coding style guide
This commit is contained in:
20
applications/lfrfid/helpers/osc_fsk.cpp
Normal file
20
applications/lfrfid/helpers/osc_fsk.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user