lf: change macros to allow float freq, change 134 -> 134.2

This commit is contained in:
Philippe Teuwen 2019-10-25 00:42:47 +02:00
commit eb7268cd98
5 changed files with 15 additions and 14 deletions

View file

@ -590,9 +590,10 @@ typedef struct {
#define PM3_EFATAL -99
// LF
#define LF_DIVISOR(f) (((12000 + (f)/2)/(f))-1)
#define LF_DIVISOR_125 LF_DIVISOR(125)
#define LF_DIVISOR_134 LF_DIVISOR(134)
#define LF_FREQ2DIV(f) ((int)(((12000.0 + (f)/2.0)/(f))-1))
#define LF_DIVISOR_125 LF_FREQ2DIV(125)
#define LF_DIVISOR_134 LF_FREQ2DIV(134.2)
#define LF_DIV2FREQ(d) (12000.0/((d)+1))
// Receiving from USART need more than 30ms as we used on USB
// else we get errors about partial packet reception