bug fixes, keypad work
This commit is contained in:
parent
51b884c44c
commit
77338a6b34
@ -3,18 +3,18 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#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);
|
||||
|
||||
|
16
initrd/init
16
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!"
|
||||
|
BIN
libinterp.a
BIN
libinterp.a
Binary file not shown.
26
src/keypad.c
26
src/keypad.c
@ -1,18 +1,18 @@
|
||||
#include <keypad.h>
|
||||
#include <gpio.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
33
xinitrd/init
Normal file
33
xinitrd/init
Normal file
@ -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)
|
21
xinitrd/init2
Normal file
21
xinitrd/init2
Normal file
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user