Changing GPIO on conditions


#1

Hi All,
Is there a way to change GPIO settings on conditions? To get my FSR strip working I need to read pressure first, which needs certain configuration. To then read position I need to switch some pins from digital out (low to clear capactive voltages) then back to analog to read the data.


#2

Another question (or two).

1) What does the "postive = true" flag do on the GPIO DIgital outs?

2) When set to Push Pull. Why both?


#3

This is best done by making a custom object for the FSR strip, that takes care of toggling the gpio settings and latching the analog readout. Do you have a link to a datasheet or something that documents the requirements?

Oh, this comment is a leftover from early days when boolean wires did not exist yet.

I don't get the question, both what?


#4

Yep, I do. I'll have a go myself thanks.

So what does the boolean actually do? Set the output as high?

I don't get it either. I think I'm confused with pull up resistors. I guess it means it can be high or low depending on the boolean?


#5

The output mode is either "Push pull" or "open drain".

In push-pull mode, setting the output to high/true means it acts as a 3.3V voltage source, setting the output to low/false means it acts as a 0V voltage source. This is the usual mode.

In open-drain mode, setting the output to high/true means it is a floating output, the actual voltage on the output depends on external circuitry on the GPIO pad. Setting the output to low/false means it acts as a 0V voltage source. This can be used to create a 5V logic output, by connecting a resistor between the GPIO pad and +5V. Or some communication protocols use this, the most common example is I2C.

Is that the missing piece of the puzzle?


#6

Great. Thanks Johannes. I expect I can get the FSR working (with some noise) with just that knowledge.