summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2012-09-19 11:06:59 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2012-09-19 11:06:59 -0400
commitfd3246c8939d3db256d7aaa85343094df84abfd8 (patch)
tree26cd0ac109178925159508d9479f4f2d02cd5c7b
parent8dd603c8036f4eafd440ac14234d42d6c5eaefab (diff)
added a power fail input pin (low = OK, high = bad)
-rw-r--r--bus.c3
-rw-r--r--bus.h1
-rw-r--r--instr-daemon.c5
3 files changed, 8 insertions, 1 deletions
diff --git a/bus.c b/bus.c
index 0683113..43de205 100644
--- a/bus.c
+++ b/bus.c
@@ -325,7 +325,8 @@ static unsigned gpio_pins[] = { GPIO0_X + 22, // i.e., GPIO0_22
GPIO0_X + 26,
GPIO1_X + 15, // i.e., GPIO1_15
GPIO1_X + 14,
- GPIO0_X + 27
+ GPIO0_X + 27,
+ GPIO1_X + 12
};
diff --git a/bus.h b/bus.h
index f13f203..c72aacb 100644
--- a/bus.h
+++ b/bus.h
@@ -18,6 +18,7 @@
#define O_GATE 3 /* gates output */
#define OUTPUT_RELAY 4 /* output enable/disable relay */
#define PW_ENABLE 5 /* TTL enable/disable output */
+#define POWER_FAIL 6 /* pulled low if +24V OK, pulled high if power fails */
// A5, A6 used to select chips
#define Octal_DACportCS_low 0x00
diff --git a/instr-daemon.c b/instr-daemon.c
index d749721..c03236b 100644
--- a/instr-daemon.c
+++ b/instr-daemon.c
@@ -311,6 +311,11 @@ int main(int argc, char **argv)
static gboolean periodic_poll (void)
{
+ if (bus_getpin (POWER_FAIL)) {
+ printf ("power fail detected\n");
+ } else {
+ printf ("power OK\n");
+ }
Menu_Check_Buttons ();