Skip to content

Commit 2350688

Browse files
committed
Update of Raspberry Pi GPIO App
-Fixed the get_function task -Disable GPIOs that aren't currently input or outputs
1 parent 93ce46c commit 2350688

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

GPIO_GUI/gpio.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ def __init__(self,parent,pin=0,name=None,**kw):
100100
self.led.grid(column=3,row=0)
101101

102102
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
104106

105107
## def _configurePin(self, y):
106108
## """Future capability to setup pull up/down"""
@@ -128,11 +130,11 @@ def setMode(self):
128130
def getPinFunctionName(self,pin):
129131
functions = {pi.IN:'Input',
130132
pi.OUT:'Output',
133+
pi.I2C:'I2C',
131134
pi.SPI:'SPI',
132135
pi.HARD_PWM:'HARD_PWM',
133136
pi.SERIAL:'Serial',
134-
pi.UNKNOWN:'Unknown'}
135-
137+
pi.UNKNOWN:'Unknown'}
136138
return functions[pi.gpio_function(pin)]
137139

138140

@@ -176,6 +178,7 @@ def updateInput(self):
176178
def updateCurrentFunction(self):
177179
pinFunction = self.getPinFunctionName(self.pin)
178180
self.current_mode.set(pinFunction)
181+
return pinFunction
179182
##print("GPIO %s is an %s" % (self.pin,pinFunction))
180183

181184

0 commit comments

Comments
 (0)