kopia lustrzana https://github.com/micropython/micropython-lib
lora-sx126x: Clean up some struct formatting.
Changes are cosmetic - and maybe very minor code size - but not functional. _reg_read() was calling struct.packinto() with an incorrect number of arguments but it seems like MicroPython didn't mind, as result is correct for both versions. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>pull/804/head
rodzic
35bb7952ba
commit
224246531e
|
@ -469,7 +469,7 @@ class _SX126x(BaseModem):
|
|||
# See DS 13.1.12 Calibrate Function
|
||||
|
||||
# calibParam 0xFE means to calibrate all blocks.
|
||||
self._cmd("<BB", _CMD_CALIBRATE, 0xFE)
|
||||
self._cmd("BB", _CMD_CALIBRATE, 0xFE)
|
||||
|
||||
time.sleep_us(_CALIBRATE_TYPICAL_TIME_US)
|
||||
|
||||
|
@ -545,7 +545,7 @@ class _SX126x(BaseModem):
|
|||
else:
|
||||
timeout = 0 # Single receive mode, no timeout
|
||||
|
||||
self._cmd(">BBH", _CMD_SET_RX, timeout >> 16, timeout)
|
||||
self._cmd(">BBH", _CMD_SET_RX, timeout >> 16, timeout) # 24 bits
|
||||
|
||||
return self._dio1
|
||||
|
||||
|
@ -729,10 +729,10 @@ class _SX126x(BaseModem):
|
|||
return res
|
||||
|
||||
def _reg_read(self, addr):
|
||||
return self._cmd("BBBB", _CMD_READ_REGISTER, addr >> 8, addr & 0xFF, n_read=1)[0]
|
||||
return self._cmd(">BHB", _CMD_READ_REGISTER, addr, 0, n_read=1)[0]
|
||||
|
||||
def _reg_write(self, addr, val):
|
||||
return self._cmd("BBBB", _CMD_WRITE_REGISTER, addr >> 8, addr & 0xFF, val & 0xFF)
|
||||
return self._cmd(">BHB", _CMD_WRITE_REGISTER, addr, val & 0xFF)
|
||||
|
||||
|
||||
class _SX1262(_SX126x):
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
metadata(version="0.1.1")
|
||||
metadata(version="0.1.2")
|
||||
require("lora")
|
||||
package("lora")
|
||||
|
|
Ładowanie…
Reference in New Issue