diff --git a/include/keypad.h b/include/keypad.h index 83e0626..5eec1fc 100644 --- a/include/keypad.h +++ b/include/keypad.h @@ -3,18 +3,18 @@ #include -#define K0 (1 << 0) -#define K1 (1 << 1) -#define K2 (1 << 2) -#define K3 (1 << 3) -#define K4 (1 << 4) -#define K5 (1 << 5) -#define K6 (1 << 6) -#define K7 (1 << 7) -#define K8 (1 << 8) -#define K9 (1 << 9) -#define KS (1 << 10) -#define KP (1 << 11) +#define K0 (uint16_t)(1 << 0) +#define K1 (uint16_t)(1 << 1) +#define K2 (uint16_t)(1 << 2) +#define K3 (uint16_t)(1 << 3) +#define K4 (uint16_t)(1 << 4) +#define K5 (uint16_t)(1 << 5) +#define K6 (uint16_t)(1 << 6) +#define K7 (uint16_t)(1 << 7) +#define K8 (uint16_t)(1 << 8) +#define K9 (uint16_t)(1 << 9) +#define KS (uint16_t)(1 << 10) +#define KP (uint16_t)(1 << 11) void keypad_init(void); diff --git a/initrd/init b/initrd/init index fcf9ec2..4351743 100644 --- a/initrd/init +++ b/initrd/init @@ -1,15 +1 @@ -do - getkey > input - if (input & 4) - rand 479 > x - rand 319 > y - rand 479 > i - rand 319 > j - rand 32767 > purple - - line x y i j purple - end -while (1) - -print "done" - +print "Hello, world!" diff --git a/libinterp.a b/libinterp.a index 561bb11..d52e280 100644 Binary files a/libinterp.a and b/libinterp.a differ diff --git a/src/keypad.c b/src/keypad.c index 41fc924..06e0b6a 100644 --- a/src/keypad.c +++ b/src/keypad.c @@ -1,18 +1,18 @@ #include #include -#define PIN_0 GPIO_PORT(A, 11) -#define PIN_1 GPIO_PORT(B, 13) -#define PIN_2 GPIO_PORT(B, 2) -#define PIN_3 GPIO_PORT(A, 12) -#define PIN_4 GPIO_PORT(B, 14) -#define PIN_5 GPIO_PORT(B, 11) -#define PIN_6 GPIO_PORT(C, 5) -#define PIN_7 GPIO_PORT(B, 15) -#define PIN_8 GPIO_PORT(B, 12) -#define PIN_9 GPIO_PORT(C, 6) -#define PIN_S GPIO_PORT(B, 1) -#define PIN_P GPIO_PORT(C, 8) +#define PIN_0 GPIO_PORT(B, 2) +#define PIN_1 GPIO_PORT(B, 1) +#define PIN_2 GPIO_PORT(A, 11) +#define PIN_3 GPIO_PORT(C, 8) +#define PIN_4 GPIO_PORT(B, 15) +#define PIN_5 GPIO_PORT(B, 12) +#define PIN_6 GPIO_PORT(C, 6) +#define PIN_7 GPIO_PORT(B, 14) +#define PIN_8 GPIO_PORT(B, 11) +#define PIN_9 GPIO_PORT(C, 5) +#define PIN_S GPIO_PORT(B, 13) +#define PIN_P GPIO_PORT(A, 12) typedef struct { GPIO_TypeDef *port; @@ -43,7 +43,7 @@ void keypad_init(void) gpio_mode(p, pin, OUTPUT); gpio_dout(p, pin, 0); gpio_mode(p, pin, INPUT); - gpio_pupd(p, pin, PULLDOWN); + //gpio_pupd(p, pin, PULLDOWN); } } diff --git a/src/main.c b/src/main.c index abcb8e6..74ae6b7 100644 --- a/src/main.c +++ b/src/main.c @@ -23,6 +23,8 @@ void task_interpreter(void); int main(void) { asm("cpsid i"); + // disable cached writes for precise debug info + //*((uint32_t *)0xE000E008) |= 2; // prepare flash latency for 80MHz operation FLASH->ACR &= ~(FLASH_ACR_LATENCY); @@ -59,6 +61,7 @@ void kmain(void) while (1) { gpio_dout(GPIOA, 5, (keypad_isdown(K0))); + delay(10); /*gpio_dout(GPIOA, 5, 1); delay(250); gpio_dout(GPIOA, 5, 0); diff --git a/xinitrd/init b/xinitrd/init new file mode 100644 index 0000000..4fd74dd --- /dev/null +++ b/xinitrd/init @@ -0,0 +1,33 @@ +print "Hello." + +set fg 32767 + +# draw bg, lines +rect 50 50 380 220 6375 +line 50 160 430 160 fg +line 240 50 240 270 fg + +set x 50 +do + line x 170 x 150 fg + set x (x + 20) +while (x < 431) + +set y 50 +do + line 230 y 250 y fg + set y (y + 20) +while (y < 271) + +do + rand 379 > x + rand 219 > y + rand 379 > i + rand 219 > j + set x (x + 50) + set y (y + 50) + set i (i + 50) + set j (j + 50) + + line x y i j 511 +while (1) diff --git a/xinitrd/init2 b/xinitrd/init2 new file mode 100644 index 0000000..47dbae1 --- /dev/null +++ b/xinitrd/init2 @@ -0,0 +1,21 @@ +do + getkey > input + print input + delay 1000 +while (1) + +#do +# getkey > input +# if (input & 4) +# rand 479 > x +# rand 319 > y +# rand 479 > i +# rand 319 > j +# rand 32767 > purple +# +# line x y i j purple +# end +#while (1) +# +#print "done" +