Bumpers and pull-ups

Moderator: Steve

Bumpers and pull-ups

Postby alanmcdonley » 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:
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)
alanmcdonley
 
Posts: 90
Joined: Thu Jul 23, 2015 10:50 am
Location: Boynton Beach, Florida

Re: Bumpers and pull-ups

Postby mikronauts » Thu Sep 03, 2015 8:23 pm

Good question, as always :)

PDLALib was based on RoboPiLib, and the P8X32A microcontroller on RoboPi does not have internal pull ups.

Having said that, I'll add a new pin mode, INPUT_PULLUP in the near future, which will be stored in the pinMode state array.

(I don't mind the pushing, while I can't promise to implement all suggestions, I will implement what I can fit into the architecture as I have time)
mikronauts
 
Posts: 119
Joined: Tue Sep 16, 2014 6:58 pm


Return to Pi Droid Alpha

Who is online

Users browsing this forum: No registered users and 1 guest

cron