diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-09-19 11:06:59 -0400 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-09-19 11:06:59 -0400 |
commit | fd3246c8939d3db256d7aaa85343094df84abfd8 (patch) | |
tree | 26cd0ac109178925159508d9479f4f2d02cd5c7b | |
parent | 8dd603c8036f4eafd440ac14234d42d6c5eaefab (diff) |
added a power fail input pin (low = OK, high = bad)
-rw-r--r-- | bus.c | 3 | ||||
-rw-r--r-- | bus.h | 1 | ||||
-rw-r--r-- | instr-daemon.c | 5 |
3 files changed, 8 insertions, 1 deletions
@@ -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 }; @@ -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 (); |