Skip to content

Commit 58d2610

Browse files
committed
alif/boards/ALIF_ENSEMBLE: Add all SW1 pins and enable pull-ups on them.
Signed-off-by: Damien George <damien@micropython.org>
1 parent aac4653 commit 58d2610

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

ports/alif/boards/ALIF_ENSEMBLE/board.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,12 @@ const ospi_flash_settings_t ospi_flash_settings[] = {
5454
},
5555
};
5656
const size_t ospi_flash_settings_len = 1;
57+
58+
void board_early_init(void) {
59+
// Configure the joystick buttons as an input with pull-up enabled.
60+
mp_hal_pin_config(pin_JOY_LEFT, MP_HAL_PIN_MODE_INPUT, MP_HAL_PIN_PULL_UP, 0, 0, 0, true);
61+
mp_hal_pin_config(pin_JOY_RIGHT, MP_HAL_PIN_MODE_INPUT, MP_HAL_PIN_PULL_UP, 0, 0, 0, true);
62+
mp_hal_pin_config(pin_JOY_DOWN, MP_HAL_PIN_MODE_INPUT, MP_HAL_PIN_PULL_UP, 0, 0, 0, true);
63+
mp_hal_pin_config(pin_JOY_UP, MP_HAL_PIN_MODE_INPUT, MP_HAL_PIN_PULL_UP, 0, 0, 0, true);
64+
mp_hal_pin_config(pin_JOY_SW, MP_HAL_PIN_MODE_INPUT, MP_HAL_PIN_PULL_UP, 0, 0, 0, true);
65+
}

ports/alif/boards/ALIF_ENSEMBLE/mpconfigboard.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,7 @@
5454
#define MICROPY_HW_FLASH_STORAGE_BYTES (32 * 1024 * 1024)
5555
#define MICROPY_HW_FLASH_STORAGE_FS_BYTES (16 * 1024 * 1024)
5656
#define MICROPY_HW_FLASH_STORAGE_ROMFS_BYTES (16 * 1024 * 1024)
57+
58+
#define MICROPY_BOARD_EARLY_INIT board_early_init
59+
60+
void board_early_init(void);

ports/alif/boards/ALIF_ENSEMBLE/pins.csv

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ OSPI1_D6,P10_3
1212
OSPI1_D7,P10_4
1313
OSPI1_RXDS,P10_7
1414

15+
# LEDs
1516
LED_BLUE,P12_0
1617
LED_RED,P12_3
18+
19+
# SW1 joystick
1720
JOY_LEFT,P15_0
1821
JOY_RIGHT,P15_1
22+
JOY_DOWN,P15_2
23+
JOY_UP,P15_3
24+
JOY_SW,P15_4
1925

2026
# UART buses
2127
UART0_TX,P0_1

0 commit comments

Comments
 (0)