Fixed glitching keyboard buttons on MDx targets

This commit is contained in:
Silvano Seva 2020-12-07 21:25:12 +01:00 committed by Niccolò Izzo
parent a3decb8d85
commit 47dd9e2046
2 changed files with 16 additions and 15 deletions

View File

@ -331,14 +331,15 @@ void display_renderRows(uint8_t startRow, uint8_t endRow)
/* /*
* Put screen data lines back to alternate function mode, since they are in * Put screen data lines back to alternate function mode, since they are in
* common with keyboard buttons and the keyboard driver sets them as inputs. * common with keyboard buttons and the keyboard driver sets them as inputs.
* Little HACK: we bypass GPIO API and write directly into GPIO control
* registers.
*/ */
gpio_setMode(LCD_D0, ALTERNATE);
GPIOD->MODER &= ~0xF000000F; /* Clear old values */ gpio_setMode(LCD_D1, ALTERNATE);
GPIOE->MODER &= ~0x3FC000; gpio_setMode(LCD_D2, ALTERNATE);
GPIOD->MODER |= 0xA000000A; /* Back to AF mode */ gpio_setMode(LCD_D3, ALTERNATE);
GPIOE->MODER |= 0x2A8000; gpio_setMode(LCD_D4, ALTERNATE);
gpio_setMode(LCD_D5, ALTERNATE);
gpio_setMode(LCD_D6, ALTERNATE);
gpio_setMode(LCD_D7, ALTERNATE);
gpio_clearPin(LCD_CS); gpio_clearPin(LCD_CS);

View File

@ -54,14 +54,14 @@ keyboard_t kbd_getKeys()
* with the display, their configuration can have been screwed up by display * with the display, their configuration can have been screwed up by display
* driver among two subsequent calls of this function. * driver among two subsequent calls of this function.
*/ */
gpio_setMode(LCD_D0, INPUT); gpio_setMode(LCD_D0, INPUT_PULL_DOWN);
gpio_setMode(LCD_D1, INPUT); gpio_setMode(LCD_D1, INPUT_PULL_DOWN);
gpio_setMode(LCD_D2, INPUT); gpio_setMode(LCD_D2, INPUT_PULL_DOWN);
gpio_setMode(LCD_D3, INPUT); gpio_setMode(LCD_D3, INPUT_PULL_DOWN);
gpio_setMode(LCD_D4, INPUT); gpio_setMode(LCD_D4, INPUT_PULL_DOWN);
gpio_setMode(LCD_D5, INPUT); gpio_setMode(LCD_D5, INPUT_PULL_DOWN);
gpio_setMode(LCD_D6, INPUT); gpio_setMode(LCD_D6, INPUT_PULL_DOWN);
gpio_setMode(LCD_D7, INPUT); gpio_setMode(LCD_D7, INPUT_PULL_DOWN);
/* /*
* Scan keyboard by coloumns. * Scan keyboard by coloumns.