pcf.ino 984 Bytes
#include "pcf.h"

void updateButton(struct button *buttonX) {
  int read = 0; //!pcf8574.digitalRead(buttonX->pin);
  buttonX->pressed = ( buttonX->holding == 0 && read == 1 ) ? (1) : (0);
  buttonX->released = ( buttonX->holding == 1 && read == 0 ) ? (1) : (0);
  buttonX->holding = read;
}

void setup_pcf () {
  pcf8591.begin(sda,scl);

  for (int pin = 0; pin < 8; pin ++) {
    pcf8574.pinMode(pin, OUTPUT);
  }
  pcf8574.begin();
  for (int pin = 0; pin < 8; pin ++) {
    pcf8574.digitalWrite(pin,1);
  }


  /* button1->pin = 1; */
  /* button1->holding = 0; */
  /* button1->pressed = 0; */
  /* button1->released = 0; */

  /* button2->pin = 2; */
  /* button2->holding = 0; */
  /* button2->pressed = 0; */
  /* button2->released = 0; */

  /* button3->pin = 3; */
  /* button3->holding = 0; */
  /* button3->pressed = 0; */
  /* button3->released = 0; */
}

void loop_pcf () {
  /* updateButton(button1); */
  /* updateButton(button2); */
  /* updateButton(button3); */
}