summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-06-10 19:21:01 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-06-10 19:22:12 -0400
commit60f063265e8e2aa34ba419255f1ae41fe2596417 (patch)
treed64a1cdb85920c15eb2f41d7c94a42916e583c2e
parent5dd2629e28291c58f41a70cf3de478cfc7ae3db8 (diff)
downloadnodeMCU_rf_source_lmx2487-60f063265e8e2aa34ba419255f1ae41fe2596417.tar.gz
nodeMCU_rf_source_lmx2487-60f063265e8e2aa34ba419255f1ae41fe2596417.zip
conversion of decimal numbers to binary is done in when registers are calculated
-rw-r--r--freq2lmx2487settings.lua26
1 files changed, 13 insertions, 13 deletions
diff --git a/freq2lmx2487settings.lua b/freq2lmx2487settings.lua
index c3031e9..1de1cad 100644
--- a/freq2lmx2487settings.lua
+++ b/freq2lmx2487settings.lua
@@ -16,18 +16,7 @@ function freq2regestersValues(freq)
local RF_FD = 4000000 --magic number
local RF_FN = math.floor( (frac * RF_FD) + 0.5)
- local bRF_N=toBits(RF_N)
- local bRF_FN=toBits(RF_FN)
- local bRF_FD=toBits(RF_FD)
- pad2NumBitsInPlace(bRF_N, 11)
- pad2NumBitsInPlace(bRF_FN, 22)
- pad2NumBitsInPlace(bRF_FD, 22)
-
- -- print("bRF_N = "..bin2string(bRF_N, " "))
- -- print("bRF_FN = "..bin2string(bRF_FN, " "))
- -- print("bRF_FD = "..bin2string(bRF_FD, " "))
-
- return freq, bRF_N, bRF_FN, bRF_FD
+ return freq, RF_N, RF_FN, RF_FD
end
------ INITIAL SETTINGS (send to chip)-------
@@ -63,7 +52,18 @@ end
--------- SLICE AND REPLACE ------------
function FreqToSettings(freq, old_settings) --create table with new values of R0, R1, and R5
local settings= copySettings(old_settings)
- local freq, bRF_N, bRF_FN, bRF_FD = freq2regestersValues(freq)
+ local freq, RF_N, RF_FN, RF_FD = freq2regestersValues(freq)
+
+ local bRF_N=toBits(RF_N)
+ local bRF_FN=toBits(RF_FN)
+ local bRF_FD=toBits(RF_FD)
+ pad2NumBitsInPlace(bRF_N, 11)
+ pad2NumBitsInPlace(bRF_FN, 22)
+ pad2NumBitsInPlace(bRF_FD, 22)
+
+ -- print("bRF_N = "..bin2string(bRF_N, " "))
+ -- print("bRF_FN = "..bin2string(bRF_FN, " "))
+ -- print("bRF_FD = "..bin2string(bRF_FD, " "))
--print(bin2string(settings["R0"], " "))
settings["R0"]=tableReplace(settings["R0"], bRF_N, 14, 24)