raspberry-sharp / raspberry-sharp-io

A .NET/Mono IO Library for Raspberry Pi
339 stars 139 forks source link

PCF8574 internal pull-up resitor? #21

Closed genemars closed 9 years ago

genemars commented 9 years ago

Is there a way to set the internal pull-up resistor with PCF8574?

http://www.homegenie.it/forum/index.php?topic=400.0

Cheers, g.

ebezine commented 9 years ago

Hello,

There is no way to change the internal resistor of a PCF8574, which is always a pull-up resistor. There seem to be an issue in PCF8574 implementation, regarding the way input pins are handled.

According to WiringPi implementation (https://github.com/Gadgetoid/WiringPi2-Python/blob/master/WiringPi/wiringPi/pcf8574.c), Input pins must be set to high in order to work.

Hence SetPinStatus as well as Toogle should probably use connection.Write(newStatus | inputPins) and SetInputPin shoud proceed to connection.Write(currentStatus | inputPins) after having set pin status.