]> code.bitgloo.com Git - clyne/calculator.git/commitdiff
bug fixes, keypad work
authorClyne Sullivan <tullivan99@gmail.com>
Mon, 5 Mar 2018 16:36:00 +0000 (11:36 -0500)
committerClyne Sullivan <tullivan99@gmail.com>
Mon, 5 Mar 2018 16:36:00 +0000 (11:36 -0500)
include/keypad.h
initrd/init
libinterp.a
src/keypad.c
src/main.c
xinitrd/init [new file with mode: 0644]
xinitrd/init2 [new file with mode: 0644]

index 83e0626cf91ebf019517411240ee2b4e624fdcd5..5eec1fcaf0d78e7d75c64d614205da5f62c19b38 100644 (file)
@@ -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);
 
index fcf9ec2017a27f14a182f8bfde41aff0e57e4eb1..4351743673f4349e2b27499793738b739d5c6dbe 100644 (file)
@@ -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!"
index 561bb117745f0e49781af7e939807f7b499c1067..d52e2803bcf46de59182df5e14cd76914da2038a 100644 (file)
Binary files a/libinterp.a and b/libinterp.a differ
index 41fc924c65392f4e12eb915b8a6e916326885d08..06e0b6a33ebeb172e36bc95601908ad6ad371e16 100644 (file)
@@ -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);
        }
 }
 
index abcb8e62508a6c48c05c2a134b9fbe5a3bd59410..74ae6b72b79749c422424997b1075189d8f04a25 100644 (file)
@@ -23,6 +23,8 @@ void task_interpreter(void);
 int main(void)\r
 {\r
        asm("cpsid i");\r
+       // disable cached writes for precise debug info\r
+       //*((uint32_t *)0xE000E008) |= 2;\r
 \r
        // prepare flash latency for 80MHz operation\r
        FLASH->ACR &= ~(FLASH_ACR_LATENCY);\r
@@ -59,6 +61,7 @@ void kmain(void)
        while (1) {\r
                gpio_dout(GPIOA, 5,\r
                        (keypad_isdown(K0)));\r
+               delay(10);\r
                /*gpio_dout(GPIOA, 5, 1);\r
                delay(250);\r
                gpio_dout(GPIOA, 5, 0);\r
diff --git a/xinitrd/init b/xinitrd/init
new file mode 100644 (file)
index 0000000..4fd74dd
--- /dev/null
@@ -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 (file)
index 0000000..47dbae1
--- /dev/null
@@ -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"
+