From d3d586b6d20608cd1e0cb979f0f1bc7afdf551b1 Mon Sep 17 00:00:00 2001 From: ayabusa Date: Mon, 1 Apr 2024 18:32:34 +0200 Subject: [PATCH] added timer support, and incomplete keyboard system --- .vscode/settings.json | 4 +- numworks_port/build/Laplace/gpio_helper.o | Bin 5604 -> 6224 bytes numworks_port/build/Laplace/keyboard.o | Bin 0 -> 4396 bytes numworks_port/build/Laplace/laplace.o | Bin 2368 -> 2440 bytes numworks_port/build/Laplace/time.o | Bin 0 -> 2920 bytes numworks_port/build/main.bin | Bin 66805 -> 67421 bytes numworks_port/build/main.elf | Bin 275616 -> 278736 bytes numworks_port/build/main.o | Bin 2336 -> 2384 bytes numworks_port/src/Laplace/gpio_helper.c | 28 ++++++++ numworks_port/src/Laplace/gpio_helper.h | 1 + numworks_port/src/Laplace/keyboard.c | 74 ++++++++++++++++++++++ numworks_port/src/Laplace/keyboard.h | 27 ++++++++ numworks_port/src/Laplace/laplace.c | 5 ++ numworks_port/src/Laplace/laplace.h | 1 + numworks_port/src/Laplace/time.c | 13 ++++ numworks_port/src/Laplace/time.h | 18 ++++++ numworks_port/src/main.c | 14 +++- numworks_port/src/main.h | 2 + 18 files changed, 184 insertions(+), 3 deletions(-) create mode 100644 numworks_port/build/Laplace/keyboard.o create mode 100644 numworks_port/build/Laplace/time.o create mode 100644 numworks_port/src/Laplace/keyboard.c create mode 100644 numworks_port/src/Laplace/keyboard.h create mode 100644 numworks_port/src/Laplace/time.c create mode 100644 numworks_port/src/Laplace/time.h diff --git a/.vscode/settings.json b/.vscode/settings.json index 13b0224..02bb9b3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -19,6 +19,8 @@ "tuple": "cpp", "main.h": "c", "led.h": "c", - "stm32f730xx.h": "c" + "stm32f730xx.h": "c", + "keyboard.h": "c", + "gpio_helper.h": "c" } } \ No newline at end of file diff --git a/numworks_port/build/Laplace/gpio_helper.o b/numworks_port/build/Laplace/gpio_helper.o index 5e119b80713dd96cfdcdbae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AIag~;c5#2)s>Sm|2Z$+E4Lgn- zF=15~?Zp}>yMPk`8ueUZ0=MSk81`Tv4U5H>V)4bYX<5dS884ZYCA%;&=wv!FEK_x| z^z5*avx^sTm}#tzrKhUZ5<4}067Ra>)6<7y14H`{(F)>}zdkq?AAR({uL!q{wW8lg z<4pN*xHaU|ed4K6kxzzwFY#o!JsE0JE`)u_P-yB$D7!3%PEEcDlHtHh$|r^A6X5_H zH+*QU0yV}ir_zu34zt`V~ z!tr49Qa<+A`(C?BmB!Olr?_kqs;49pt1`{mlT8oK+MxV+gW!&x*6p?j<2$cAX+%7F z32!!)HE$}AREAfLr>V^Sn3R<2%q}(Zr`_LdDvPiVp;9Ih1FhL==8-v<2Pys>i903?aDt`Sl+P)IhEh7GO~)K-TGqM>1xBS zHSBb)SYdV3$iq#lTb_5u?jVPjE_`znZo^v?>5%@IK-zr;pI-D_E7;12K)5(M-i-JV zWX>Kba2gPNLf`>`69Q??6z8l!`a&Vy5Qy(0M_&>6F@awe_#J^i5%?Q{^n#^0Z2~EO z(hmwu5hD4MLO(}{gT5g2JR#O$3H^DYe@^JH3jMm!e<<*00^bz&-wJ$7ptFB?MCsfq z{wo4I3GwLRi^JiM2z^rM8KLKe&U9huYOLztrt8j5-Bb%+87vZ&GHR?uX$)tfBRH;}oK8tmu45#Gj zIo+`BdNJFu5#-&shvAB?V)B;Le?IT0l>ETj37&5HBs#TE;F`yPbXRFS`B7!qEp+FD z9de0`o+j0O;K=`f`3=H{#^C6jM)9Ofgp5b$CuQO*P})6?(l!p8cO75CIwoPHb6|52`K&k4P=IUasU7T literal 0 HcmV?d00001 diff --git a/numworks_port/build/Laplace/laplace.o b/numworks_port/build/Laplace/laplace.o index dd5dd2383737841e7a8dcb34e9c9d709b89e3ce7..2cb6cb80ea24d2d9372472c3addf3fe62dce1fc4 100644 GIT binary patch delta 293 zcmX>g)FC`UfiYvEq9Qw!!vF98{xeLp)M8Ycm=Xyj_QmijF(82VWOYVoCIh?8nT*RB zC-X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 zGBEWfWHeLfsVR-Augk#nzc&L@Kc0bmkl;rqNz7%=py3LrExK=#U-kFPuG zDO7mc#3NKOm8G7;ow|=5wU>rH{81{ZJ{dWL`!d99!95pE{u%dlyeOXTkW$#8OuqpV z5kxwLKBpbxjLd~S$_7Q15jOyn2EG`W2V&Cf&`eZ#h)(0HQ90M3<89ph688N=YAtt2 ze!lud*jr&AM+d4wu*df^QtBP&h;{(;voCG`tMhP{;_>ZZhW}f@Jj3JWb?{wQFc@Bp zcP2?fc|RV(6UFPJ4LGU*FEBIo8u%D8bP@1fn9e-DvxEG~!P4qo4ETN8j}9oJehhpA zrr~DLwC@Dwmj@l9$XJq}LSK$pDI%hJfj@^s4-Dw=c*+6oc_Vll_!M-`H|j3}C$K96 zdIJ~)K9}N8M*ab;_y|2+6u$;;!2nYJmnj#-Z5b)s0tfyBfmKMRw`FsS?+7>m+jM?yM6vUq99&Rq-5EThoGtPnOv1|SfccqE2b2*iQ{+sV3& z+CsbxtV|#QQC3z1eO5+WCZ^5#j8hmVvoOmr3T;+o)@EcBn(WJ>KDmWOS-Lp2Bt9oK zB|b4Hhk=0wsEdmqh(WZ#=4&j|KuUAjlv!s0r35BVWm9H!oBWVXeDVc00WeD)NOH2P zGp?9y2qce8js%iylN*7g!Q_?f>a1!&hdNHa%C5}lF!?7?G<~unhdSe-$(|hQOh1?= y7jdXDdQ6@P6jGUdkVBm{f*EAZTMlK`44{SjlSMg|B_dcE7?y$j0|j8O1K9ur@;!Y3 diff --git a/numworks_port/src/Laplace/gpio_helper.c b/numworks_port/src/Laplace/gpio_helper.c index 7211792..d5ba4c2 100644 --- a/numworks_port/src/Laplace/gpio_helper.c +++ b/numworks_port/src/Laplace/gpio_helper.c @@ -59,6 +59,34 @@ void set_output_pin(uint8_t gpio_x, uint8_t pin, bool state){ } } +bool read_input_pin(uint8_t gpio_x, uint8_t pin){ + // Invert the IDR register since '0' means 'pressed'. + uint8_t idr_val = 0; + switch (gpio_x) + { + case GPIO_A: + idr_val = ~GPIOA->IDR; + break; + case GPIO_B: + idr_val = ~GPIOB->IDR; + break; + case GPIO_C: + idr_val = ~GPIOC->IDR; + break; + case GPIO_D: + idr_val = ~GPIOD->IDR; + break; + case GPIO_E: + idr_val = ~GPIOE->IDR; + break; + + default: + break; + } + + return idr_val & (1 << pin); +} + void enable_gpio_x_rcc(uint8_t gpio_x){ switch (gpio_x) { diff --git a/numworks_port/src/Laplace/gpio_helper.h b/numworks_port/src/Laplace/gpio_helper.h index 4f73d94..a09f88f 100644 --- a/numworks_port/src/Laplace/gpio_helper.h +++ b/numworks_port/src/Laplace/gpio_helper.h @@ -17,6 +17,7 @@ #define GPIO_E 4 void set_output_pin(uint8_t gpio_x, uint8_t pin, bool state); +bool read_input_pin(uint8_t gpio_x, uint8_t pin); void enable_gpio_x_rcc(uint8_t gpio_x); #endif \ No newline at end of file diff --git a/numworks_port/src/Laplace/keyboard.c b/numworks_port/src/Laplace/keyboard.c new file mode 100644 index 0000000..46f2e13 --- /dev/null +++ b/numworks_port/src/Laplace/keyboard.c @@ -0,0 +1,74 @@ +/* The keyboard is a matrix that is laid out as follow: + * (K_B2 and K_B3 are respectively specific to N0100 and N0110 + * + * | PC0 | PC1 | PC2 | PC3 | PC4 | PC5 | + * -----+------+------+------+------+------+------+ + * PE0 | K_A1 | K_A2 | K_A3 | K_A4 | K_A5 | K_A6 | + * -----+------+------+------+------+------+------+ + * PE1 | K_B1 |(K_B2)|(K_B3)| | | | + * -----+------+------+------+------+------+------+ + * PE2 | K_C1 | K_C2 | K_C3 | K_C4 | K_C5 | K_C6 | + * -----+------+------+------+------+------+------+ + * PE3 | K_D1 | K_D2 | K_D3 | K_D4 | K_D5 | K_D6 | + * -----+------+------+------+------+------+------+ + * PE4 | K_E1 | K_E2 | K_E3 | K_E4 | K_E5 | K_E6 | + * -----+------+------+------+------+------+------+ + * PE5 | K_F1 | K_F2 | K_F3 | K_F4 | K_F5 | | + * -----+------+------+------+------+------+------+ + * PE6 | K_G1 | K_G2 | K_G3 | K_G4 | K_G5 | | + * -----+------+------+------+------+------+------+ + * PE7 | K_H1 | K_H2 | K_H3 | K_H4 | K_H5 | | + * -----+------+------+------+------+------+------+ + * PE8 | K_I1 | K_I2 | K_I3 | K_I4 | K_I5 | | + * -----+------+------+------+------+------+------| + * + * We decide to drive the rows (PE0-8) and read the columns (PC0-5). + * + * To avoid short-circuits, the pins E0-E8 will not be standard outputs but + * only open-drain. Open drain means the pin is either driven low or left + * floating. + * When a user presses multiple keys, a connection between two rows can happen. + * If we don't use open drain outputs, this situation could trigger a short + * circuit between an output driving high and another driving low. + * + * If the outputs are open-drain, this means that the input must be pulled up. + * So if the input reads "1", this means the key is in fact *not* pressed, and + * if it reads "0" it means that there's a short to an open-drain output. Which + * means the corresponding key is pressed. + */ + +#include "keyboard.h" + +const uint8_t number_of_rows = 9; +const uint8_t number_of_columns = 6; + +void keyboard_init(){ + for (int i = 0; i < number_of_rows; i++){ + // setup rows (output open drain) + GPIOA->MODER &= ~(0x3 << (i*2)); + GPIOA->MODER |= (0x1 << (i*2)); + GPIOA->OTYPER |= (1 << i); + } + for (int i = 0; i < number_of_columns; i++){ + // setup columns (input pullup) + GPIOC->MODER &= ~(0x3 << (i*2)); + GPIOC->PUPDR &= ~(0x3 << (i*2)); + GPIOC->PUPDR |= (0x1 << (i*2)); + } +} + +bool keyboard_scan(){ + set_output_pin(GPIO_A, 6, true); + bool key_state = read_input_pin(GPIO_C, 3); + return key_state; + // A LOT TODO +} + +void activate_row(uint8_t row_nb){ + // set all row to 0 and then reenable selected row + for(int i =0; i < number_of_rows; i++){ + set_output_pin(GPIO_A, i, true); + } + set_output_pin(GPIO_A, row_nb, false); + us_wait(100); +} \ No newline at end of file diff --git a/numworks_port/src/Laplace/keyboard.h b/numworks_port/src/Laplace/keyboard.h new file mode 100644 index 0000000..32d7b97 --- /dev/null +++ b/numworks_port/src/Laplace/keyboard.h @@ -0,0 +1,27 @@ +/** @file keyboard.h + * + * @brief All action related to keyboard scan + * + */ + +#ifndef KEYBOARD_H +#define KEYBOARD_H + +enum PIN_ROW { + A = 1, + B = 0, + C = 2, + D = 3, + E = 4, + F = 5, + G = 6, + H = 7, + I = 8 +}; + +#include "gpio_helper.h" + +void keyboard_init(); +bool keyboard_scan(); + +#endif \ No newline at end of file diff --git a/numworks_port/src/Laplace/laplace.c b/numworks_port/src/Laplace/laplace.c index 4edfdd9..deb4ae3 100644 --- a/numworks_port/src/Laplace/laplace.c +++ b/numworks_port/src/Laplace/laplace.c @@ -4,4 +4,9 @@ void laplace_init(){ // Enable the GPIO peripheral in RCC. enable_gpio_x_rcc(GPIO_B); led_init(); + //col (in) + enable_gpio_x_rcc(GPIO_C); + //row (out) + enable_gpio_x_rcc(GPIO_A); + keyboard_init(); } \ No newline at end of file diff --git a/numworks_port/src/Laplace/laplace.h b/numworks_port/src/Laplace/laplace.h index d775efb..626bf7e 100644 --- a/numworks_port/src/Laplace/laplace.h +++ b/numworks_port/src/Laplace/laplace.h @@ -9,6 +9,7 @@ #include "gpio_helper.h" #include "led.h" +#include "keyboard.h" void laplace_init(); diff --git a/numworks_port/src/Laplace/time.c b/numworks_port/src/Laplace/time.c new file mode 100644 index 0000000..c257d18 --- /dev/null +++ b/numworks_port/src/Laplace/time.c @@ -0,0 +1,13 @@ +#include "time.h" + +void us_wait(uint8_t micro_seconds) { + for (volatile uint32_t i=0; i