Skip to content

Commit 9046529

Browse files
authored
Merge pull request #1086 from kkitayam/impl_close_all_for_khci
Implement dcd_edpt_close_all() and fix dcd_edpt_clear_stall() for frdm_kl25z
2 parents 03866dd + b363afc commit 9046529

File tree

3 files changed

+184
-85
lines changed

3 files changed

+184
-85
lines changed

hw/bsp/frdm_kl25z/board.mk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ CFLAGS += \
88
-DCPU_MKL25Z128VLK4 \
99
-DCFG_TUSB_MCU=OPT_MCU_MKL25ZXX
1010

11+
LDFLAGS += \
12+
-Wl,--defsym,__stack_size__=0x400 \
13+
-Wl,--defsym,__heap_size__=0
14+
1115
# mcu driver cause following warnings
12-
CFLAGS += -Wno-error=unused-parameter
16+
CFLAGS += -Wno-error=unused-parameter -Wno-error=format
1317

1418
MCU_DIR = $(SDK_DIR)/devices/MKL25Z4
1519

hw/bsp/frdm_kl25z/frdm_kl25z.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ void USB0_IRQHandler(void)
5454
#define LED_PIN_FUNCTION kPORT_MuxAsGpio
5555
#define LED_STATE_ON 0
5656

57+
// Button
58+
#define BUTTON_PORT GPIOC
59+
#define BUTTON_PIN_CLOCK kCLOCK_PortC
60+
#define BUTTON_PIN_PORT PORTC
61+
#define BUTTON_PIN 9U
62+
#define BUTTON_PIN_FUNCTION kPORT_MuxAsGpio
63+
#define BUTTON_STATE_ACTIVE 0
64+
5765
// UART
5866
#define UART_PORT UART0
5967
#define UART_PIN_CLOCK kCLOCK_PortA
@@ -84,7 +92,19 @@ void board_init(void)
8492
PORT_SetPinMux(LED_PIN_PORT, LED_PIN, LED_PIN_FUNCTION);
8593
gpio_pin_config_t led_config = { kGPIO_DigitalOutput, 0 };
8694
GPIO_PinInit(LED_PORT, LED_PIN, &led_config);
87-
board_led_write(true);
95+
board_led_write(false);
96+
97+
#if defined(BUTTON_PORT) && defined(BUTTON_PIN)
98+
// Button
99+
CLOCK_EnableClock(BUTTON_PIN_CLOCK);
100+
port_pin_config_t button_port = {
101+
.pullSelect = kPORT_PullUp,
102+
.mux = BUTTON_PIN_FUNCTION,
103+
};
104+
PORT_SetPinConfig(BUTTON_PIN_PORT, BUTTON_PIN, &button_port);
105+
gpio_pin_config_t button_config = { kGPIO_DigitalInput, 0 };
106+
GPIO_PinInit(BUTTON_PORT, BUTTON_PIN, &button_config);
107+
#endif
88108

89109
// UART
90110
CLOCK_EnableClock(UART_PIN_CLOCK);
@@ -119,6 +139,9 @@ void board_led_write(bool state)
119139

120140
uint32_t board_button_read(void)
121141
{
142+
#if defined(BUTTON_PORT) && defined(BUTTON_PIN)
143+
return BUTTON_STATE_ACTIVE == GPIO_ReadPinInput(BUTTON_PORT, BUTTON_PIN);
144+
#endif
122145
return 0;
123146
}
124147

0 commit comments

Comments
 (0)