GeezerVison is showing github.com — Update of Raspberry Pi GPIO App · LeoJr2015/python@2350688
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: GPIO_GUI/gpio.py +6-3Lines changed: 6 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -100,7 +100,9 @@ def __init__(self,parent,pin=0,name=None,**kw): |
100 | 100 | self.led.grid(column=3,row=0) |
101 | 101 |
|
102 | 102 | self.set_state.config(state=DISABLED) |
103 | | - self.updateCurrentFunction() |
| 103 | + function = self.updateCurrentFunction() |
| 104 | + if function not in ['Input','Output']: |
| 105 | + self.mode_sel['state'] = DISABLED |
104 | 106 |
|
105 | 107 | ## def _configurePin(self, y): |
106 | 108 | ## """Future capability to setup pull up/down""" |
@@ -128,11 +130,11 @@ def setMode(self): |
128 | 130 | def getPinFunctionName(self,pin): |
129 | 131 | functions = {pi.IN:'Input', |
130 | 132 | pi.OUT:'Output', |
| 133 | + pi.I2C:'I2C', |
131 | 134 | pi.SPI:'SPI', |
132 | 135 | pi.HARD_PWM:'HARD_PWM', |
133 | 136 | pi.SERIAL:'Serial', |
134 | | - pi.UNKNOWN:'Unknown'} |
135 | | - |
| 137 | + pi.UNKNOWN:'Unknown'} |
136 | 138 | return functions[pi.gpio_function(pin)] |
137 | 139 |
|
138 | 140 |
|
@@ -176,6 +178,7 @@ def updateInput(self): |
176 | 178 | def updateCurrentFunction(self): |
177 | 179 | pinFunction = self.getPinFunctionName(self.pin) |
178 | 180 | self.current_mode.set(pinFunction) |
| 181 | + return pinFunction |
179 | 182 | ##print("GPIO %s is an %s" % (self.pin,pinFunction)) |
180 | 183 |
|
181 | 184 |
|
|