From efd1e11475088284803f5db0f554f6ef2d0268f5 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Tue, 27 Mar 2018 12:00:57 -0400 Subject: [PATCH] functional keypad, va_arg bug discovery --- include/gpio.h | 12 ++++---- initrd/init | 12 ++++---- libinterp.a | Bin 47938 -> 71812 bytes link.ld | 12 ++++---- src/gpio.c | 12 ++++---- src/keypad.c | 66 +++++++++++++++++++++---------------------- src/keypad.c.bak | 72 ----------------------------------------------- src/script.c | 26 ++++++++++++++--- 8 files changed, 79 insertions(+), 133 deletions(-) delete mode 100644 src/keypad.c.bak diff --git a/include/gpio.h b/include/gpio.h index 58ebaa7..08feb86 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -83,7 +83,7 @@ void gpio_init(void); * @param pupd pullup/pulldown enable * @see GPIO_PUPD */ -void gpio_pupd(GPIO_TypeDef *port, uint8_t pin, uint8_t pupd); +void gpio_pupd(GPIO_TypeDef *port, uint32_t pin, uint32_t pupd); /** * Sets whether to use push-pull or open drain for the given pin. @@ -92,7 +92,7 @@ void gpio_pupd(GPIO_TypeDef *port, uint8_t pin, uint8_t pupd); * @param type what to use * @see GPIO_TYPE */ -void gpio_type(GPIO_TypeDef *port, uint8_t pin, uint8_t type); +void gpio_type(GPIO_TypeDef *port, uint32_t pin, uint32_t type); /** * Sets the pin's speed. @@ -101,7 +101,7 @@ void gpio_type(GPIO_TypeDef *port, uint8_t pin, uint8_t type); * @param speed the speed to use * @see GPIO_SPEED */ -void gpio_speed(GPIO_TypeDef *port, uint8_t pin, uint8_t speed); +void gpio_speed(GPIO_TypeDef *port, uint32_t pin, uint32_t speed); /** * Sets the pin's i/o mode. @@ -110,7 +110,7 @@ void gpio_speed(GPIO_TypeDef *port, uint8_t pin, uint8_t speed); * @param mode the mode to use * @see GPIO_MODE */ -void gpio_mode(GPIO_TypeDef *port, uint8_t pin, uint8_t mode); +void gpio_mode(GPIO_TypeDef *port, uint32_t pin, uint32_t mode); /** * Sets the state of a digital output pin. @@ -118,7 +118,7 @@ void gpio_mode(GPIO_TypeDef *port, uint8_t pin, uint8_t mode); * @param pin the pin * @param val non-zero for high, zero for low */ -void gpio_dout(GPIO_TypeDef *port, uint8_t pin, uint8_t val); +void gpio_dout(GPIO_TypeDef *port, uint32_t pin, uint32_t val); /** * Reads a digital input pin. @@ -126,6 +126,6 @@ void gpio_dout(GPIO_TypeDef *port, uint8_t pin, uint8_t val); * @param pin the pin * @return non-zero for high, zero for low */ -uint8_t gpio_din(GPIO_TypeDef *port, uint8_t pin); +uint32_t gpio_din(GPIO_TypeDef *port, uint32_t pin); #endif // GPIO_H_ diff --git a/initrd/init b/initrd/init index 17eb48d..7359f16 100644 --- a/initrd/init +++ b/initrd/init @@ -1,8 +1,8 @@ -input = 0 while (1) { - while (input == 0) { - input = getkey - } - print(input) - input = 0 + print("> ") + input = gets() + answer = solve(input) + print("\n") + print(answer) + print("\n") } diff --git a/libinterp.a b/libinterp.a index f00993242e5414ac266362cd0e4f61c02760a9bc..a485352ff9c5eb2672f03a312ff0e174cb2487a4 100644 GIT binary patch delta 24141 zcmcJ1dwi6|)&D%t?q+YfY%Z_~+1+fegd~t~50F4Wh#=vjq7nr+Aqi{*Ld=C*kPQlo zcW^AWN|lOQyj2ToL21>ht*zRER_lef6l>eJwHB+bC{=&o?>w`)SlYhtAHV&4o;l~t zoO9;PJoC);%>M8n=GO1pcLZY-#*LpiHXN=9^EWUIhbN7mpkl+}29FS8ju5st|MN5Q z86o~}Pwd|dEUOXX|NC<;GC92P-#@=TEX0|flY4|X^K&3z95P~^T^&uU*0i++q*lX2-mc$V6|vn(bCn}u_6v5P}JJi zPquZhUe?k9MeB9K>c*8Vk+qE-Z35VQg?18E*z!KCMRav+AYW_avQ-wLRf%QYt*g3P z+d40od)1*0wID z8A!7|hzxC+We9|AkNhBExN*L`X+rkIi^-a^1)*WH3-<@$wTBf6>pcHJ9`=IU$Rljk zP+>1T1j2irj5>2;3DlXmgVDknc7z`Qx91ILaO4sdo~_W~$a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PG}8|b3ExX~Wfq$+`>)Jk$K*7Uzm!`^zAE2a8B1BNuPh~*w<>|Hm36CPgU%v) zw=dV^j1swFRZliazPu`vUbsG973<^}-|pMqMkTvLI#(yKF|yz4KJ1E|xOz0(B@e6~ zML$JJu_m7VNv5xfWy9s@HDg$s+_`1~yDG)n1a9S>nQNPD|IS;Q@gv3WH*f8%|8)ob zzCLr}#Muo^of%s{i(+re$OFc269=}jTxmNvmwxAIBY8@Ge=wQ7C*u#raZA4MO|ABj jlQ54T!rR#vl0D=RlI8MqlEpIkaH4r0y<}1R*^qw$(q6N- diff --git a/link.ld b/link.ld index b7adb78..231269a 100644 --- a/link.ld +++ b/link.ld @@ -41,8 +41,8 @@ SECTIONS { *(.text) *(.text*) - *(.init) - *(.fini) + KEEP(*(.init)) + KEEP(*(.fini)) . = ALIGN(8); } > FLASH @@ -64,14 +64,14 @@ SECTIONS { /* init_array/fini_array (TODO understand this) */ .init_array : { __init_array_start = .; - KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array.*)) KEEP(*(.init_array*)) __init_array_end = .; } > FLASH .fini_array : { __fini_array_start = .; - KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array.*)) KEEP(*(.fini_array*)) __fini_array_end = .; } > FLASH @@ -88,10 +88,10 @@ SECTIONS { /* uninitialized data */ .bss : { - . = ALIGN(4); + . = ALIGN(8); __bss_start__ = .; *(.bss) - . = ALIGN(4); + . = ALIGN(8); __bss_end__ = .; } > RAM } diff --git a/src/gpio.c b/src/gpio.c index 2e50e88..db67465 100644 --- a/src/gpio.c +++ b/src/gpio.c @@ -26,36 +26,36 @@ void gpio_init(void) RCC->AHB2ENR |= 0xFF; } -void gpio_pupd(GPIO_TypeDef *port, uint8_t pin, uint8_t pupd) +void gpio_pupd(GPIO_TypeDef *port, uint32_t pin, uint32_t pupd) { port->PUPDR &= ~(0x03 << (2 * pin)); port->PUPDR |= pupd << (2 * pin); } -void gpio_speed(GPIO_TypeDef *port, uint8_t pin, uint8_t speed) +void gpio_speed(GPIO_TypeDef *port, uint32_t pin, uint32_t speed) { port->OSPEEDR &= ~(0x03 << (2 * pin)); port->OSPEEDR |= speed << (2 * pin); } -void gpio_type(GPIO_TypeDef *port, uint8_t pin, uint8_t type) +void gpio_type(GPIO_TypeDef *port, uint32_t pin, uint32_t type) { port->OTYPER &= ~(1 << pin); port->OTYPER |= type << pin; } -void gpio_mode(GPIO_TypeDef *port, uint8_t pin, uint8_t mode) +void gpio_mode(GPIO_TypeDef *port, uint32_t pin, uint32_t mode) { port->MODER &= ~(0x03 << (2 * pin)); port->MODER |= mode << (2 * pin); } -void gpio_dout(GPIO_TypeDef *port, uint8_t pin, uint8_t val) +void gpio_dout(GPIO_TypeDef *port, uint32_t pin, uint32_t val) { port->BSRR |= (1 << (val ? pin : pin + 16)); } -uint8_t gpio_din(GPIO_TypeDef *port, uint8_t pin) +uint32_t gpio_din(GPIO_TypeDef *port, uint32_t pin) { return port->IDR & (1 << pin); } diff --git a/src/keypad.c b/src/keypad.c index 20a67c2..f76271c 100644 --- a/src/keypad.c +++ b/src/keypad.c @@ -23,15 +23,15 @@ #include #include -#define ROW_0 GPIO_PORT(B, 15) -#define ROW_1 GPIO_PORT(B, 14) -#define ROW_2 GPIO_PORT(B, 13) +#define ROW_0 GPIO_PORT(A, 12) +#define ROW_1 GPIO_PORT(B, 12) +#define ROW_2 GPIO_PORT(B, 11) #define ROW_3 GPIO_PORT(C, 4) -#define COL_0 GPIO_PORT(B, 1) -#define COL_1 GPIO_PORT(B, 2) -#define COL_2 GPIO_PORT(B, 11) -#define COL_3 GPIO_PORT(B, 12) -#define COL_4 GPIO_PORT(A, 11) +#define COL_0 GPIO_PORT(B, 13) +#define COL_1 GPIO_PORT(B, 14) +#define COL_2 GPIO_PORT(B, 15) +#define COL_3 GPIO_PORT(B, 1) +#define COL_4 GPIO_PORT(B, 2) #define ROWS 4 #define COLS 5 @@ -49,43 +49,43 @@ static const port_t keypad_cols[COLS] = { { COL_0 }, { COL_1 }, { COL_2 }, { COL_3 }, { COL_4 } }; -//static const int keypad_map[ROWS][COLS] = { -// { '7', '8', '9', 'x', '/' }, -// { '4', '5', '6', 'y', '*' }, -// { '3', '2', '1', 'z', '-' }, -// { '.', '0', '\b', '\n', '+' } -//}; +static const int keypad_map[ROWS][COLS] = { + { '7', '8', '9', 'x', '/' }, + { '4', '5', '6', 'y', '*' }, + { '1', '2', '3', '=', '-' }, + { '.', '0', '\b', '\n', '+' } +}; #define BUFFER_SIZE 8 -static char keypad_buffer = 'A';//[BUFFER_SIZE]; +static char keypad_buffer = 0;//[BUFFER_SIZE]; //static int keypad_buffer_pos = -1; void keypad_task(void) { - //unsigned int col = 0; + unsigned int col = 0; while (1) { - // gpio_dout(keypad_cols[col].port, keypad_cols[col].pin, 1); - // for (unsigned int row = 0; row < ROWS; row++) { - // if (gpio_din(keypad_rows[row].port, keypad_rows[row].pin)) { - // //if (keypad_buffer_pos < BUFFER_SIZE) - // keypad_buffer/*[++keypad_buffer_pos]*/ = keypad_map[row][col]; - // while (gpio_din(keypad_rows[row].port, keypad_rows[row].pin)) - // delay(1); - // break; - // } - // } - // gpio_dout(keypad_cols[col].port, keypad_cols[col].pin, 0); - // col++; - // if (col == COLS) - // col = 0; - + gpio_dout(keypad_cols[col].port, keypad_cols[col].pin, 1); delay(10); + for (unsigned int row = 0; row < ROWS; row++) { + if (gpio_din(keypad_rows[row].port, keypad_rows[row].pin)) { + //if (keypad_buffer_pos < BUFFER_SIZE) + keypad_buffer/*[++keypad_buffer_pos]*/ = keypad_map[row][col]; + while (gpio_din(keypad_rows[row].port, keypad_rows[row].pin)) + delay(1); + break; + } + } + + gpio_dout(keypad_cols[col].port, keypad_cols[col].pin, 0); + col++; + if (col == COLS) + col = 0; } } void keypad_init(void) { - for (uint8_t i = 0; i < ROWS; i++) { + for (int i = 0; i < ROWS; i++) { GPIO_TypeDef *p = keypad_rows[i].port; uint16_t pin = keypad_rows[i].pin; gpio_mode(p, pin, OUTPUT); @@ -95,7 +95,7 @@ void keypad_init(void) gpio_pupd(p, pin, PULLDOWN); } - for (uint8_t i = 0; i < COLS; i++) { + for (int i = 0; i < COLS; i++) { GPIO_TypeDef *p = keypad_cols[i].port; uint16_t pin = keypad_cols[i].pin; gpio_mode(p, pin, OUTPUT); diff --git a/src/keypad.c.bak b/src/keypad.c.bak deleted file mode 100644 index 2fbefff..0000000 --- a/src/keypad.c.bak +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @file keypad.c - * Manages the GPIO keypad using IO expanders - * - * Copyright (C) 2018 Clyne Sullivan - * - * 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 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include - -#define ADDR 0x20 - -#define CONTROL 0x41 -#define ADDRESS 0x12 - -void keypad_init(void) -{ - // clock init - RCC->CCIPR &= ~(RCC_CCIPR_I2C1SEL_Msk); - RCC->CCIPR |= 2 << RCC_CCIPR_I2C1SEL_Pos; - RCC->APB1ENR1 |= RCC_APB1ENR1_I2C1EN; - - // set times - // PRESC, SCLDEL, SDADEL, SCLH, SCLL - I2C1->TIMINGR = (0 << 28) | (2 << 20) | (0 << 16) | (2 << 8) | 4; - - // gpio init - gpio_mode(GPIOB, 8, ALTERNATE); - gpio_mode(GPIOB, 9, ALTERNATE); - GPIOB->AFR[1] &= ~(0xFF); - GPIOB->AFR[1] |= 0x44; - - // go go go - I2C1->CR1 |= I2C_CR1_PE; - - I2C1->CR2 |= ADDR << 1; - //I2C1->CR2 |= I2C_CR2_RD_WRN; - I2C1->CR2 &= ~(I2C_CR2_NBYTES); - I2C1->CR2 |= 1 << I2C_CR2_NBYTES_Pos; - I2C1->CR2 |= I2C_CR2_RELOAD; - I2C1->CR2 |= I2C_CR2_START; - - while (!(I2C1->ISR & I2C_ISR_TXE)); - - I2C1->TXDR = ADDRESS; - - while (I2C1->ISR & I2C_ISR_BUSY); - - I2C1->ICR |= 0x30; - I2C1->CR2 |= I2C_CR2_RD_WRN; - I2C1->CR2 |= I2C_CR2_RELOAD; - I2C1->CR2 |= I2C_CR2_START; - - while (1) { - while (!(I2C1->ISR & I2C_ISR_RXNE)); - uint32_t v = I2C1->RXDR; - (void)v; - } -} diff --git a/src/script.c b/src/script.c index be0fa37..0ce5509 100644 --- a/src/script.c +++ b/src/script.c @@ -35,6 +35,7 @@ #define igetarg_integer(it, n) ((int)igetarg(it, n)->value.f) int script_puts(instance *it); +int script_putchar(instance *it); int script_gets(instance *it); int script_delay(instance *it); int script_rect(instance *it); @@ -49,6 +50,7 @@ int script_menu(instance *it); void script_loadlib(instance *it) { inew_cfunc(it, "print", script_puts); + inew_cfunc(it, "putchar", script_putchar); inew_cfunc(it, "gets", script_gets); inew_cfunc(it, "getkey", script_getkey); inew_cfunc(it, "ppos", script_ppos); @@ -86,7 +88,7 @@ int script_puts(instance *it) variable *v = igetarg(it, 0); if (v->type == NUMBER) { char buf[33]; - snprintf(buf, 33, "%f", v->value.f); + snprintf(buf, 33, "%d", (int)v->value.f); // TODO dsp_puts(buf); } else if (v->type == STRING) { dsp_puts((const char *)v->value.p); @@ -94,6 +96,18 @@ int script_puts(instance *it) return 0; } +int script_putchar(instance *it) +{ + variable *v = igetarg(it, 0); + char buf[2]; + + buf[0] = (int)v->value.f; + buf[1] = '\0'; + dsp_puts(buf); + + return 0; +} + int script_gets(instance *it) { char *s = malloc(64); @@ -101,7 +115,11 @@ int script_gets(instance *it) int index = 0; do { - c[0] = serial_get(); + do { + c[0] = keypad_get(); + delay(1); + } while (c[0] == 0); + //c[0] = serial_get(); s[index] = c[0]; if (c[0] == '\b' || c[0] == 127) { index--; @@ -109,10 +127,10 @@ int script_gets(instance *it) dsp_puts("\b"); index--; } - } else if (c[0] != '\r') { + } else if (c[0] != '\n'/*'\r'*/) { dsp_puts(c); } - } while (s[index] != '\r' && index++ < 63); + } while (s[index] != '\n'/*'\r'*/ && index++ < 63); s[index] = '\0'; variable *r = make_vars(0, s);