From 149be29ac78d96fe55bc116cd7780f2dd5b10e1c Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Mon, 5 Sep 2011 14:10:42 -0300 Subject: [PATCH] labsw/fw/: make loop use all front panel elements; set CH1/2 opto to open-drain --- labsw/fw/labsw.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/labsw/fw/labsw.c b/labsw/fw/labsw.c index b97f7c9..459e667 100644 --- a/labsw/fw/labsw.c +++ b/labsw/fw/labsw.c @@ -28,10 +28,18 @@ static void init_io(void) LED_MAIN_R_MODE |= 1 << LED_MAIN_R_BIT; LED_MAIN_G_MODE |= 1 << LED_MAIN_G_BIT; + LED_CH1_R_MODE |= 1 << LED_CH1_R_BIT; + LED_CH1_G_MODE |= 1 << LED_CH1_G_BIT; + LED_CH2_R_MODE |= 1 << LED_CH2_R_BIT; + LED_CH2_G_MODE |= 1 << LED_CH2_G_BIT; CH1_RELAY = 0; CH2_RELAY = 0; CH1_RELAY_MODE |= 1 << CH1_RELAY_BIT; CH2_RELAY_MODE |= 1 << CH2_RELAY_BIT; + + /* @@@ we need this while using the boot loader of cntr */ + CH1_OPT_MODE &= ~(1 << CH1_OPT_BIT); + CH2_OPT_MODE &= ~(1 << CH2_OPT_BIT); } @@ -46,13 +54,31 @@ void main(void) if (!BUT_MAIN) { LED_MAIN_R = 1; LED_MAIN_G = 0; - CH1_RELAY = 1; - CH2_RELAY = 1; } else { LED_MAIN_R = 0; LED_MAIN_G = 1; + } + if (!BUT_CH1) { + LED_CH1_R = 1; + LED_CH1_G = 0; + CH1_RELAY = 1; + CH1_OPT = 0; + } else { + LED_CH1_R = 0; + LED_CH1_G = 1; CH1_RELAY = 0; + CH1_OPT = 1; + } + if (!BUT_CH2) { + LED_CH2_R = 1; + LED_CH2_G = 0; + CH2_RELAY = 1; + CH2_OPT = 0; + } else { + LED_CH2_R = 0; + LED_CH2_G = 1; CH2_RELAY = 0; + CH2_OPT = 1; } usb_poll(); }