#define COIN_BUTTON 7 //physically pin 7
#define SYNC_PIN 4 //physically pin 16
+#define PULSE_PIN 1 //physically pin 12
configuration config;
int expires = -1;
wiringPiSetup();
pinMode(COIN_BUTTON, INPUT);
pinMode(SYNC_PIN, INPUT);
+ pinMode(PULSE_PIN, OUTPUT);
+ digitalWrite(PULSE_PIN, 0); //just to be sure
+
pullUpDnControl(COIN_BUTTON, PUD_UP);
pullUpDnControl(SYNC_PIN, PUD_UP);
}
void pulse_switch()
{
delay(config.sync_switch_delay); //wait
- // do the biz
+ digitalWrite(PULSE_PIN, 1);
+ delay(10);
+ digitalWrite(PULSE_PIN, 0);
+ delay(10);
}
int validate_switch_state()
printf("It's all ogre now\n");
expires = -1;
switch_state = 1 - switch_state;
+
+ if(config.sync_switch == 0) //naively pulse
+ pulse_switch();
+
return 1;
}
printf("Changing internal switch state from %d\n", switch_state);
switch_state = 1 - switch_state;
printf("Switch state is now %d\n", switch_state);
+
+ if(config.sync_switch == 0) //naively pulse the switch
+ pulse_switch();
}
if(config.external_timer != 1)