1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2025-04-21 12:27:27 +03:00

labsw/fw/: added simple button -> LED / relay change loop

This commit is contained in:
Werner Almesberger
2011-09-03 12:33:43 -03:00
parent e73383b7d8
commit 5649c890f7
4 changed files with 89 additions and 1 deletions

View File

@@ -16,9 +16,22 @@
#include "regs.h"
#include "usb.h"
#include "config.h"
#include "io.h"
static void init_io(void)
{
P0SKIP = 0xff;
P1SKIP = 0xff;
P2SKIP = 0xff;
LED_MAIN_R_MODE |= 1 << LED_MAIN_R_BIT;
LED_MAIN_G_MODE |= 1 << LED_MAIN_G_BIT;
CH1_RELAY = 0;
CH2_RELAY = 0;
CH1_RELAY_MODE |= 1 << CH1_RELAY_BIT;
CH2_RELAY_MODE |= 1 << CH2_RELAY_BIT;
}
@@ -30,6 +43,17 @@ void main(void)
// ep0_init();
while (1) {
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;
CH1_RELAY = 0;
CH2_RELAY = 0;
}
usb_poll();
}
}