1
0
mirror of git://projects.qi-hardware.com/antorcha.git synced 2024-11-01 01:36:16 +02:00

whirl/fw/: firmware for design testing: LED bar, 8:10 card, "joystick"

This commit is contained in:
Werner Almesberger 2012-11-17 15:39:18 -03:00
parent a5befafb90
commit d8663289dc
2 changed files with 44 additions and 5 deletions

View File

@ -16,9 +16,10 @@ NAME = whirl
CFLAGS = -g -mmcu=$(CHIP) \
-DBOOT_ADDR=$(BOOT_ADDR) \
-Wall -Wextra -Wshadow -Werror -Wno-unused-parameter \
-Wall -Wextra -Wshadow -Wno-unused-parameter \
-Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes \
-I../../ben-wpan/atusb/fw/include/
# -Wall -Wextra -Wshadow -Werror -Wno-unused-parameter \
CHIP = atmega168
HOST = jlime

View File

@ -24,7 +24,7 @@
#define SCLK CARD_DAT1
#define LCLK CARD_DAT0
#define DS CARD_CLK
#define VDD CARD_CMD
static void send(uint16_t pattern)
{
@ -47,6 +47,8 @@ static void send(uint16_t pattern)
int main(void)
{
uint16_t n = 0;
uint8_t last = 0xff;
uint8_t sw = 0xff;
PORTB = HIGH(B);
PORTC = HIGH(C);
@ -68,15 +70,51 @@ int main(void)
OUT(LCLK);
OUT(DS);
SET(VDD);
OUT(VDD);
#if 0
while (1) {
SET(DS);
CLR(DS);
SET(SCLK);
CLR(SCLK);
}
#endif
#if 0
while (1) {
uint8_t v = 0;
v = PIN(SW_N) | PIN(SW_E) << 1 | PIN(SW_S) << 2 |
PIN(SW_W) << 3 | PIN(SW_SW) << 4;
if (v != sw) {
sw = v;
n = 0;
continue;
}
n++;
if (n < 10)
continue;
if (!(sw & 1))
SET(DS);
if (!(sw & 4))
CLR(DS);
if (!(sw & 2))
SET(SCLK);
if (!(sw & 8))
CLR(SCLK);
if (sw & 16)
CLR(LCLK);
else
SET(LCLK);
last = sw;
}
#endif
#if 1
while (1) {
send(n);
n++;
_delay_ms(100);
// _delay_ms(100);
#endif
}
}