Skip to content

Added Support for SX1276 LoRa module for long range wireless communication #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jun 8, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
further changes based on Codacy recommendations
  • Loading branch information
jithinbp committed Jun 8, 2017
commit 2e6c2647e3b15fbfe76bd18c72a72c5436427e5a
3 changes: 1 addition & 2 deletions PSL/Peripherals.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ def __captureStart__(self,address,location,sample_length,total_samples,tg):
def __retrievebuffer__(self):
'''
Fetch data acquired by the I2C scope. refer to :func:`__captureStart__`

'''
total_int_samples = self.total_bytes/2
DATA_SPLITTING = 500
Expand Down Expand Up @@ -457,7 +456,7 @@ def __retrievebuffer__(self):
self.H.__sendInt__(total_int_samples%DATA_SPLITTING)
self.H.__sendInt__(total_int_samples-total_int_samples%DATA_SPLITTING)
rem = 2*(total_int_samples%DATA_SPLITTING)+1
for a in range(20):
for _ in range(20):
partial = self.H.fd.read(rem) #reading int by int sometimes causes a communication error. this works better.
rem -=len(partial)
data+=partial
Expand Down
12 changes: 5 additions & 7 deletions PSL/SENSORS/Sx1276.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#Registers adapted from sample code for SEMTECH SX1276
import time

def connect(SPI):
return SX1276(SPI)
def connect(SPI,frq,**kwargs):
return SX1276(SPI,frq,**kwargs)


class SX1276():
Expand Down Expand Up @@ -56,7 +56,6 @@ class SX1276():

PA_OUTPUT_RFO_PIN =0
PA_OUTPUT_PA_BOOST_PIN =1

_onReceive = 0
_frequency = 10
_packetIndex = 0
Expand Down Expand Up @@ -196,10 +195,10 @@ def reset(self):


def idle(self):
self.SPIWrite(self.REG_OP_MODE,[self.MODE_LONG_RANGE_MODE|self.MODE_STDBY])
self.SPIWrite(self.REG_OP_MODE,[self.MODE_LONG_RANGE_MODE|self.MODE_STDBY])

def sleep(self):
self.SPIWrite(self.REG_OP_MODE,[self.MODE_LONG_RANGE_MODE|self.MODE_SLEEP])
self.SPIWrite(self.REG_OP_MODE,[self.MODE_LONG_RANGE_MODE|self.MODE_SLEEP])

def setTxPower(self,level,pin):
if pin == self.PA_OUTPUT_RFO_PIN:
Expand Down Expand Up @@ -308,11 +307,10 @@ def getRaw(self):

if __name__ == "__main__":
RX = 0; TX=1
import time
mode = RX
from PSL import sciencelab
I= sciencelab.connect()
lora = SX1276(I.SPI,434e6,boost=True,power=17,BW=125e3,SF=12,CR=5) #settings for maximum range
lora = SX1276(I.SPI,434e6,boost=True,power=17,BW=125e3,SF=12,CR=5) #settings for maximum range
lora.crc()
cntr=0
while 1:
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy