Skip to content

Commit 69e7ef6

Browse files
committed
delete all the other stuff
1 parent a8ea1eb commit 69e7ef6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+23
-3927
lines changed

Adafruit_ADS1x15/Adafruit_ADS1x15.py

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python3
22

33
import time
44
import smbus
@@ -142,7 +142,7 @@ def __init__(self, address=0x48, ic=__IC_ADS1015, debug=False):
142142
# Make sure the IC specified is valid
143143
if ((ic < self.__IC_ADS1015) | (ic > self.__IC_ADS1115)):
144144
if (self.debug):
145-
print "ADS1x15: Invalid IC specfied: %h" % ic
145+
print ("ADS1x15: Invalid IC specfied: %h" % ic)
146146
return -1
147147
else:
148148
self.ic = ic
@@ -162,7 +162,7 @@ def readADCSingleEnded(self, channel=0, pga=6144, sps=250):
162162
# With invalid channel return -1
163163
if (channel > 3):
164164
if (self.debug):
165-
print "ADS1x15: Invalid channel specified: %d" % channel
165+
print ("ADS1x15: Invalid channel specified: %d" % channel)
166166
return -1
167167

168168
# Disable comparator, Non-latching, Alert/Rdy active low
@@ -180,12 +180,12 @@ def readADCSingleEnded(self, channel=0, pga=6144, sps=250):
180180
config |= self.spsADS1015.setdefault(sps, self.__ADS1015_REG_CONFIG_DR_1600SPS)
181181
else:
182182
if ( (sps not in self.spsADS1115) & self.debug):
183-
print "ADS1x15: Invalid pga specified: %d, using 6144mV" % sps
183+
print ("ADS1x15: Invalid pga specified: %d, using 6144mV" % sps)
184184
config |= self.spsADS1115.setdefault(sps, self.__ADS1115_REG_CONFIG_DR_250SPS)
185185

186186
# Set PGA/voltage range, defaults to +-6.144V
187187
if ( (pga not in self.pgaADS1x15) & self.debug):
188-
print "ADS1x15: Invalid pga specified: %d, using 6144mV" % sps
188+
print ("ADS1x15: Invalid pga specified: %d, using 6144mV" % sps )
189189
config |= self.pgaADS1x15.setdefault(pga, self.__ADS1015_REG_CONFIG_PGA_6_144V)
190190
self.pga = pga
191191

@@ -253,7 +253,7 @@ def readADCDifferential(self, chP=0, chN=1, pga=6144, sps=250):
253253
config |= self.__ADS1015_REG_CONFIG_MUX_DIFF_1_3
254254
else:
255255
if (self.debug):
256-
print "ADS1x15: Invalid channels specified: %d, %d" % (chP, chN)
256+
print ("ADS1x15: Invalid channels specified: %d, %d" % (chP, chN))
257257
return -1
258258

259259
# Set sample per seconds, defaults to 250sps
@@ -263,12 +263,12 @@ def readADCDifferential(self, chP=0, chN=1, pga=6144, sps=250):
263263
config |= self.spsADS1015.setdefault(sps, self.__ADS1015_REG_CONFIG_DR_1600SPS)
264264
else:
265265
if ( (sps not in self.spsADS1115) & self.debug):
266-
print "ADS1x15: Invalid pga specified: %d, using 6144mV" % sps
266+
print ("ADS1x15: Invalid pga specified: %d, using 6144mV" % sps )
267267
config |= self.spsADS1115.setdefault(sps, self.__ADS1115_REG_CONFIG_DR_250SPS)
268268

269269
# Set PGA/voltage range, defaults to +-6.144V
270270
if ( (pga not in self.pgaADS1x15) & self.debug):
271-
print "ADS1x15: Invalid pga specified: %d, using 6144mV" % sps
271+
print ("ADS1x15: Invalid pga specified: %d, using 6144mV" % sps)
272272
config |= self.pgaADS1x15.setdefault(pga, self.__ADS1015_REG_CONFIG_PGA_6_144V)
273273
self.pga = pga
274274

@@ -347,7 +347,7 @@ def startContinuousConversion(self, channel=0, pga=6144, sps=250):
347347
# Default to channel 0 with invalid channel, or return -1?
348348
if (channel > 3):
349349
if (self.debug):
350-
print "ADS1x15: Invalid channel specified: %d" % channel
350+
print ("ADS1x15: Invalid channel specified: %d" % channel)
351351
return -1
352352

353353
# Disable comparator, Non-latching, Alert/Rdy active low
@@ -366,12 +366,12 @@ def startContinuousConversion(self, channel=0, pga=6144, sps=250):
366366
config |= self.spsADS1015.setdefault(sps, self.__ADS1015_REG_CONFIG_DR_1600SPS)
367367
else:
368368
if ( (sps not in self.spsADS1115) & self.debug):
369-
print "ADS1x15: Invalid pga specified: %d, using 6144mV" % sps
369+
print ("ADS1x15: Invalid pga specified: %d, using 6144mV" % sps)
370370
config |= self.spsADS1115.setdefault(sps, self.__ADS1115_REG_CONFIG_DR_250SPS)
371371

372372
# Set PGA/voltage range, defaults to +-6.144V
373373
if ( (pga not in self.pgaADS1x15) & self.debug):
374-
print "ADS1x15: Invalid pga specified: %d, using 6144mV" % sps
374+
print ("ADS1x15: Invalid pga specified: %d, using 6144mV" % sps)
375375
config |= self.pgaADS1x15.setdefault(pga, self.__ADS1015_REG_CONFIG_PGA_6_144V)
376376
self.pga = pga
377377

@@ -439,12 +439,12 @@ def startContinuousDifferentialConversion(self, chP=0, chN=1, pga=6144, sps=250)
439439
config |= self.spsADS1015.setdefault(sps, self.__ADS1015_REG_CONFIG_DR_1600SPS)
440440
else:
441441
if ( (sps not in self.spsADS1115) & self.debug):
442-
print "ADS1x15: Invalid pga specified: %d, using 6144mV" % sps
442+
print ("ADS1x15: Invalid pga specified: %d, using 6144mV" % sps)
443443
config |= self.spsADS1115.setdefault(sps, self.__ADS1115_REG_CONFIG_DR_250SPS)
444444

445445
# Set PGA/voltage range, defaults to +-6.144V
446446
if ( (pga not in self.pgaADS1x15) & self.debug):
447-
print "ADS1x15: Invalid pga specified: %d, using 6144mV" % sps
447+
print ("ADS1x15: Invalid pga specified: %d, using 6144mV" % sps)
448448
config |= self.pgaADS1x15.setdefault(pga, self.__ADS1015_REG_CONFIG_PGA_6_144V)
449449
self.pga = pga
450450

@@ -459,7 +459,7 @@ def startContinuousDifferentialConversion(self, chP=0, chN=1, pga=6144, sps=250)
459459
config |= self.__ADS1015_REG_CONFIG_MUX_DIFF_1_3
460460
else:
461461
if (self.debug):
462-
print "ADS1x15: Invalid channels specified: %d, %d" % (chP, chN)
462+
print ("ADS1x15: Invalid channels specified: %d, %d" % (chP, chN))
463463
return -1
464464

465465
# Set 'start single-conversion' bit to begin conversions
@@ -540,7 +540,7 @@ def startSingleEndedComparator(self, channel, thresholdHigh, thresholdLow, \
540540
# With invalid channel return -1
541541
if (channel > 3):
542542
if (self.debug):
543-
print "ADS1x15: Invalid channel specified: %d" % channel
543+
print ("ADS1x15: Invalid channel specified: %d" % channel)
544544
return -1
545545

546546
# Continuous mode
@@ -573,16 +573,16 @@ def startSingleEndedComparator(self, channel, thresholdHigh, thresholdLow, \
573573
# othewise it returns the value for 250sps. This saves a lot of if/elif/else code!
574574
if (self.ic == self.__IC_ADS1015):
575575
if ( (sps not in self.spsADS1015) & self.debug):
576-
print "ADS1x15: Invalid sps specified: %d, using 1600sps" % sps
576+
print ("ADS1x15: Invalid sps specified: %d, using 1600sps" % sps)
577577
config |= self.spsADS1015.setdefault(sps, self.__ADS1015_REG_CONFIG_DR_1600SPS)
578578
else:
579579
if ( (sps not in self.spsADS1115) & self.debug):
580-
print "ADS1x15: Invalid sps specified: %d, using 250sps" % sps
580+
print ("ADS1x15: Invalid sps specified: %d, using 250sps" % sps)
581581
config |= self.spsADS1115.setdefault(sps, self.__ADS1115_REG_CONFIG_DR_250SPS)
582582

583583
# Set PGA/voltage range, defaults to +-6.144V
584584
if ( (pga not in self.pgaADS1x15) & self.debug):
585-
print "ADS1x15: Invalid pga specified: %d, using 6144mV" % pga
585+
print ("ADS1x15: Invalid pga specified: %d, using 6144mV" % pga)
586586
config |= self.pgaADS1x15.setdefault(pga, self.__ADS1015_REG_CONFIG_PGA_6_144V)
587587
self.pga = pga
588588

@@ -668,16 +668,16 @@ def startDifferentialComparator(self, chP, chN, thresholdHigh, thresholdLow, \
668668
# othewise it returns the value for 250sps. This saves a lot of if/elif/else code!
669669
if (self.ic == self.__IC_ADS1015):
670670
if ( (sps not in self.spsADS1015) & self.debug):
671-
print "ADS1x15: Invalid sps specified: %d, using 1600sps" % sps
671+
print ("ADS1x15: Invalid sps specified: %d, using 1600sps" % sps)
672672
config |= self.spsADS1015.setdefault(sps, self.__ADS1015_REG_CONFIG_DR_1600SPS)
673673
else:
674674
if ( (sps not in self.spsADS1115) & self.debug):
675-
print "ADS1x15: Invalid sps specified: %d, using 250sps" % sps
675+
print ("ADS1x15: Invalid sps specified: %d, using 250sps" % sps)
676676
config |= self.spsADS1115.setdefault(sps, self.__ADS1115_REG_CONFIG_DR_250SPS)
677677

678678
# Set PGA/voltage range, defaults to +-6.144V
679679
if ( (pga not in self.pgaADS1x15) & self.debug):
680-
print "ADS1x15: Invalid pga specified: %d, using 6144mV" % pga
680+
print ("ADS1x15: Invalid pga specified: %d, using 6144mV" % pga)
681681
config |= self.pgaADS1x15.setdefault(pga, self.__ADS1015_REG_CONFIG_PGA_6_144V)
682682
self.pga = pga
683683

@@ -692,7 +692,7 @@ def startDifferentialComparator(self, chP, chN, thresholdHigh, thresholdLow, \
692692
config |= self.__ADS1015_REG_CONFIG_MUX_DIFF_1_3
693693
else:
694694
if (self.debug):
695-
print "ADS1x15: Invalid channels specified: %d, %d" % (chP, chN)
695+
print ("ADS1x15: Invalid channels specified: %d, %d" % (chP, chN))
696696
return -1
697697

698698
# Set 'start single-conversion' bit to begin conversions
@@ -718,5 +718,4 @@ def startDifferentialComparator(self, chP, chN, thresholdHigh, thresholdLow, \
718718
# Once we write the ADC will convert continously and alert when things happen,
719719
# we can read the converted values using getLastConversionResult
720720
bytes = [(config >> 8) & 0xFF, config & 0xFF]
721-
self.i2c.writeList(self.__ADS1015_REG_POINTER_CONFIG, bytes)
722-
721+
self.i2c.writeList(self.__ADS1015_REG_POINTER_CONFIG, bytes)

Adafruit_ADXL345/Adafruit_ADXL345.py

Lines changed: 0 additions & 114 deletions
This file was deleted.

Adafruit_ADXL345/Adafruit_I2C.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)