Bumpers and pull-ups
Posted: Thu Sep 03, 2015 7:46 pm
Pg 17 of the RoboPi User Manual (v1.00) "Reading Bumper Switches": it states "<insert schematic of two bumper switches, 100k pullup to 5v, shorts to ground when closed>"
I'm getting a bit ahead of the game Bill; I apologize for pushing.
The MCP23S17 of the PiDroidAlpha has built in 100k pullups.
(Another advantage of the PiDA; This combo of ADC, H-bridge, and all I/O 5v protected is just what I was looking for. The expanded DIO with interrupt mirror is a plus. I also wanted 40pin and 4 hole compatible - but I'm making due just fine. )
Back to my question:
The v0.90 PDALib already contains the Pullup Register constant DIO_GPPU pointing to the "A" bank, and the "not for public use" function writeDio(reg,val16).
Are you planning to have a 16 bit var of pullup states, with a set Pullup bit library function that uses writeDio(reg,val)?
Something like:
or something like: change the constant to DIO_GPPUA and DIO_GPPUB for use with PDALib.setDioBit(DIO_GPPUA or DIO_GPPUB, pin-8) ?
Alan (who should be wiring up my bumpers instead of talking about them)
I'm getting a bit ahead of the game Bill; I apologize for pushing.
The MCP23S17 of the PiDroidAlpha has built in 100k pullups.
(Another advantage of the PiDA; This combo of ADC, H-bridge, and all I/O 5v protected is just what I was looking for. The expanded DIO with interrupt mirror is a plus. I also wanted 40pin and 4 hole compatible - but I'm making due just fine. )
Back to my question:
The v0.90 PDALib already contains the Pullup Register constant DIO_GPPU pointing to the "A" bank, and the "not for public use" function writeDio(reg,val16).
Are you planning to have a 16 bit var of pullup states, with a set Pullup bit library function that uses writeDio(reg,val)?
Something like:
- Code: Select all
pullups = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
def setDIOpullup(pin,pinstate): # pinstate=1 enables weak (100k) pullup on pin (only when pin is configured as PDALib.INPUT)
if pin < 8:
return -1
if pin >23:
return -1
# Valid pin BankA 8-15 Bank B 16-23
pullups[pin-8] = pinstate
writeDio(DIO_GPPU,pullups)
return 0
or something like: change the constant to DIO_GPPUA and DIO_GPPUB for use with PDALib.setDioBit(DIO_GPPUA or DIO_GPPUB, pin-8) ?
Alan (who should be wiring up my bumpers instead of talking about them)