|
1 | 1 | #Registers adapted from sample code for SEMTECH SX1276
|
2 | 2 | import time
|
3 | 3 |
|
4 |
| -def connect(SPI): |
5 |
| - return SX1276(SPI) |
| 4 | +def connect(SPI,frq,**kwargs): |
| 5 | + return SX1276(SPI,frq,**kwargs) |
6 | 6 |
|
7 | 7 |
|
8 | 8 | class SX1276():
|
@@ -56,7 +56,6 @@ class SX1276():
|
56 | 56 |
|
57 | 57 | PA_OUTPUT_RFO_PIN =0
|
58 | 58 | PA_OUTPUT_PA_BOOST_PIN =1
|
59 |
| - |
60 | 59 | _onReceive = 0
|
61 | 60 | _frequency = 10
|
62 | 61 | _packetIndex = 0
|
@@ -196,10 +195,10 @@ def reset(self):
|
196 | 195 |
|
197 | 196 |
|
198 | 197 | def idle(self):
|
199 |
| - self.SPIWrite(self.REG_OP_MODE,[self.MODE_LONG_RANGE_MODE|self.MODE_STDBY]) |
| 198 | + self.SPIWrite(self.REG_OP_MODE,[self.MODE_LONG_RANGE_MODE|self.MODE_STDBY]) |
200 | 199 |
|
201 | 200 | def sleep(self):
|
202 |
| - self.SPIWrite(self.REG_OP_MODE,[self.MODE_LONG_RANGE_MODE|self.MODE_SLEEP]) |
| 201 | + self.SPIWrite(self.REG_OP_MODE,[self.MODE_LONG_RANGE_MODE|self.MODE_SLEEP]) |
203 | 202 |
|
204 | 203 | def setTxPower(self,level,pin):
|
205 | 204 | if pin == self.PA_OUTPUT_RFO_PIN:
|
@@ -308,11 +307,10 @@ def getRaw(self):
|
308 | 307 |
|
309 | 308 | if __name__ == "__main__":
|
310 | 309 | RX = 0; TX=1
|
311 |
| - import time |
312 | 310 | mode = RX
|
313 | 311 | from PSL import sciencelab
|
314 | 312 | I= sciencelab.connect()
|
315 |
| - lora = SX1276(I.SPI,434e6,boost=True,power=17,BW=125e3,SF=12,CR=5) #settings for maximum range |
| 313 | + lora = SX1276(I.SPI,434e6,boost=True,power=17,BW=125e3,SF=12,CR=5) #settings for maximum range |
316 | 314 | lora.crc()
|
317 | 315 | cntr=0
|
318 | 316 | while 1:
|
|
0 commit comments