diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2019-12-18 10:45:49 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2019-12-18 10:45:49 -0500 |
commit | 0f4f3b02cf4cf0596cb41b1bb14fac13a904635d (patch) | |
tree | df51e0bddb040833d9c8aefe6a7c0173631495df | |
parent | 9fc01286fbb63aa05244babef89d23f748425552 (diff) | |
download | nodeMCU_rf_source_lmx2487-0f4f3b02cf4cf0596cb41b1bb14fac13a904635d.tar.gz nodeMCU_rf_source_lmx2487-0f4f3b02cf4cf0596cb41b1bb14fac13a904635d.zip |
better comments
-rw-r--r-- | microwire.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/microwire.lua b/microwire.lua index 993a8b5..e2b5654 100644 --- a/microwire.lua +++ b/microwire.lua @@ -34,21 +34,24 @@ function microwire_setup_interface () end function microwire_send_data( data ) - -- essentially send data via spi interface and raise Load Enable + -- essentially send data via spi interface + -- and raise Load Enable pin for a bit (at least for25 nS) at the end of transmission + -- first low LE pin gpio.write(microwire_sle, gpio.LOW) + -- second send the data local nBytes = spi.send(spiID, data) + -- finally raise LE pin for at least 25 ns, - gpio.write(microwire_sle, gpio.HIGH) -- but since optocoupler is limiting us we will do it for longer - local microwireLEonTime = 100; -- in uS + local microwireLEonTime = 100; -- time is in uS -- the easiest to use tmr.delay( timeIn_uS ) but this halts everything -- tmr.delay( microwireLEonTime ) -- so we use timer but unfortunately the smallest time is 1ms - microwireLEonTime = 1; -- now time is in mS + microwireLEonTime = 1; -- time is in mS for timers microwire_tmr = tmr.create() microwire_tmr:register(microwireLEonTime, tmr.ALARM_SINGLE, function() gpio.write(microwire_sle, gpio.LOW) end) microwire_tmr:start() |