Files
game-and-watch-retro-go/Core/Src/gw_buttons.c
Konrad Beckmann 8bb7344101 Squash largeflash_snapshots
Squashed commit of the following:

commit 8bdab8b69ee37aeafedb8da7d13fb6c02c35cc04
Author: Konrad Beckmann <konrad.beckmann@gmail.com>
Date:   Sun Dec 6 15:11:47 2020 +0100

    Update submodule

commit eaaf1893e4dc8c6ec66039a99de057de60b5f2b5
Author: Konrad Beckmann <konrad.beckmann@gmail.com>
Date:   Sun Dec 6 15:11:38 2020 +0100

    Use HALF_QUAD_MODE

commit 069985bec8b78e3c54fda2ef632ce9d7e3e79eaf
Author: Konrad Beckmann <konrad.beckmann@gmail.com>
Date:   Sun Dec 6 15:11:27 2020 +0100

    Add missing file

commit d0bb4e89f1701097f4c8e6f81ac39561157e1ea8
Author: Thomas Roth <code@stacksmashing.net>
Date:   Sat Dec 5 13:59:18 2020 +0100

    Fix HALF_QUAD_MODE support

commit d87def7b63b297231b4b9419998d63f878cce8d6
Author: Thomas Roth <code@stacksmashing.net>
Date:   Sat Dec 5 13:42:27 2020 +0100

    Add support for different flash sizes

commit 85da98252194eaeb7344b7edd3b4655996e96344
Merge: c2be063 df701cd
Author: Konrad Beckmann <konrad.beckmann@gmail.com>
Date:   Sat Dec 5 01:06:47 2020 +0100

    Merge remote-tracking branch 'origin/main' into largeflash_snapshots

commit c2be0637a99b41dbbcdab8db96dd5a4fd9f917c1
Author: Thomas Roth <code@stacksmashing.net>
Date:   Fri Dec 4 23:07:48 2020 +0100

    Enable nearest-neighbor with -DBLIT_NEAREST

commit 4706648eb4a777431ab82ae9f16bec1535d97ae3
Author: Thomas Roth <code@stacksmashing.net>
Date:   Fri Dec 4 22:51:40 2020 +0100

    Vsync

commit 692bf35345b1eae52a2cc88510f785daf8c29ccb
Author: Thomas Roth <code@stacksmashing.net>
Date:   Fri Dec 4 22:25:26 2020 +0100

    Update retro-go-stm32

commit b3caa6dd3a946e8d0e799779130daaab15a0ae8b
Author: Thomas Roth <code@stacksmashing.net>
Date:   Fri Dec 4 20:27:27 2020 +0100

    Initial snapshot support (large flash only)
2020-12-06 15:28:42 +01:00

26 lines
1.1 KiB
C

#include "gw_buttons.h"
#include "stm32h7xx_hal.h"
#include "main.h"
#include <stdbool.h>
uint32_t buttons_get() {
bool left = HAL_GPIO_ReadPin(BTN_Left_GPIO_Port, BTN_Left_Pin) == GPIO_PIN_RESET;
bool right = HAL_GPIO_ReadPin(BTN_Right_GPIO_Port, BTN_Right_Pin) == GPIO_PIN_RESET;
bool up = HAL_GPIO_ReadPin(BTN_Up_GPIO_Port, BTN_Up_Pin) == GPIO_PIN_RESET ;
bool down = HAL_GPIO_ReadPin(BTN_Down_GPIO_Port, BTN_Down_Pin) == GPIO_PIN_RESET;
bool a = HAL_GPIO_ReadPin(BTN_A_GPIO_Port, BTN_A_Pin) == GPIO_PIN_RESET;
bool b = HAL_GPIO_ReadPin(BTN_A_GPIO_Port, BTN_B_Pin) == GPIO_PIN_RESET;
bool time = HAL_GPIO_ReadPin(BTN_TIME_GPIO_Port, BTN_TIME_Pin) == GPIO_PIN_RESET;
bool game = HAL_GPIO_ReadPin(BTN_GAME_GPIO_Port, BTN_GAME_Pin) == GPIO_PIN_RESET;
bool pause = HAL_GPIO_ReadPin(BTN_PAUSE_GPIO_Port, BTN_PAUSE_Pin) == GPIO_PIN_RESET;
bool power = HAL_GPIO_ReadPin(BTN_PWR_GPIO_Port, BTN_PWR_Pin) == GPIO_PIN_RESET;
return (
left | (up << 1) | (right << 2) | (down << 3) | (a << 4) | (b << 5) |
(time << 6) | (game << 7) | (pause << 8) | (power << 9)
);
}