mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-12-18 23:36:15 +02:00
60 lines
1.0 KiB
C
60 lines
1.0 KiB
C
/*
|
|
* labsw.c - Lab Switch initialization and main loop
|
|
*
|
|
* Written 2011 by Werner Almesberger
|
|
* Copyright 2011 Werner Almesberger
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*/
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#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;
|
|
}
|
|
|
|
|
|
void main(void)
|
|
{
|
|
init_io();
|
|
|
|
usb_init();
|
|
// 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();
|
|
}
|
|
}
|