Changeset 359
- Timestamp:
- Jan 31, 2012, 7:33:18 AM (13 years ago)
- Location:
- powerbar
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
powerbar/npm2000.py
r358 r359 19 19 20 20 MAX_BUFFER = 100 21 MAX_PORTS = 24 21 # NPM4000 22 #MAX_PORTS = 24 23 # NPM2000 24 MAX_PORTS = 8 22 25 23 26 # XOR all the 8bit values to get a checksum … … 74 77 75 78 def getPortName(number): 76 name = "U3" 77 if number <= 8: 78 name = "A%i" % number 79 elif number <= 16: 80 name = "B%i" % (number - 8) 81 elif number <= 24: 82 name = "C%i" % (number - 16) 83 else: 84 raise ValueError, "Port %i not defined" % number 79 if MAX_PORTS == 8: 80 name = "%i" % number 81 else: 82 if number <= 8: 83 name = "%Ai" % number 84 elif number <= 16: 85 name = "B%i" % (number - 8) 86 elif number <= 24: 87 name = "C%i" % (number - 16) 88 else: 89 raise ValueError, "Port %i not defined" % number 85 90 return(name) 86 91 -
powerbar/npm4000.py
r358 r359 19 19 20 20 MAX_BUFFER = 100 21 # NPM4000 21 22 MAX_PORTS = 24 23 # NPM2000 24 # MAX_PORTS = 8 22 25 23 26 # XOR all the 8bit values to get a checksum … … 74 77 75 78 def getPortName(number): 76 name = "U3" 77 if number <= 8: 78 name = "A%i" % number 79 elif number <= 16: 80 name = "B%i" % (number - 8) 81 elif number <= 24: 82 name = "C%i" % (number - 16) 83 else: 84 raise ValueError, "Port %i not defined" % number 79 if MAX_PORTS == 8: 80 name = "%i" % number 81 else: 82 if number <= 8: 83 name = "%Ai" % number 84 elif number <= 16: 85 name = "B%i" % (number - 8) 86 elif number <= 24: 87 name = "C%i" % (number - 16) 88 else: 89 raise ValueError, "Port %i not defined" % number 85 90 return(name) 86 91
Note:
See TracChangeset
for help on using the changeset viewer.