summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2021-09-17 21:40:40 +0700
committerGitHub <[email protected]>2021-09-17 21:40:40 +0700
commit90465299b42facff3c815d97950066706dbbd74a (patch)
tree941131778fae07841e976a80aa8239180e5292ef /hw
parent03866ddf9be007e8c26dc290e28093a9e59b1e17 (diff)
parentb363afc091b1cccafd7ebaf6365a6f655037d986 (diff)
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
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/frdm_kl25z/board.mk6
-rw-r--r--hw/bsp/frdm_kl25z/frdm_kl25z.c25
2 files changed, 29 insertions, 2 deletions
diff --git a/hw/bsp/frdm_kl25z/board.mk b/hw/bsp/frdm_kl25z/board.mk
index 451bc37c2..bc9240e55 100644
--- a/hw/bsp/frdm_kl25z/board.mk
+++ b/hw/bsp/frdm_kl25z/board.mk
@@ -8,8 +8,12 @@ CFLAGS += \
-DCPU_MKL25Z128VLK4 \
-DCFG_TUSB_MCU=OPT_MCU_MKL25ZXX
+LDFLAGS += \
+ -Wl,--defsym,__stack_size__=0x400 \
+ -Wl,--defsym,__heap_size__=0
+
# mcu driver cause following warnings
-CFLAGS += -Wno-error=unused-parameter
+CFLAGS += -Wno-error=unused-parameter -Wno-error=format
MCU_DIR = $(SDK_DIR)/devices/MKL25Z4
diff --git a/hw/bsp/frdm_kl25z/frdm_kl25z.c b/hw/bsp/frdm_kl25z/frdm_kl25z.c
index 7d3a173ed..cdc996bc2 100644
--- a/hw/bsp/frdm_kl25z/frdm_kl25z.c
+++ b/hw/bsp/frdm_kl25z/frdm_kl25z.c
@@ -54,6 +54,14 @@ void USB0_IRQHandler(void)
#define LED_PIN_FUNCTION kPORT_MuxAsGpio
#define LED_STATE_ON 0
+// Button
+#define BUTTON_PORT GPIOC
+#define BUTTON_PIN_CLOCK kCLOCK_PortC
+#define BUTTON_PIN_PORT PORTC
+#define BUTTON_PIN 9U
+#define BUTTON_PIN_FUNCTION kPORT_MuxAsGpio
+#define BUTTON_STATE_ACTIVE 0
+
// UART
#define UART_PORT UART0
#define UART_PIN_CLOCK kCLOCK_PortA
@@ -84,7 +92,19 @@ void board_init(void)
PORT_SetPinMux(LED_PIN_PORT, LED_PIN, LED_PIN_FUNCTION);
gpio_pin_config_t led_config = { kGPIO_DigitalOutput, 0 };
GPIO_PinInit(LED_PORT, LED_PIN, &led_config);
- board_led_write(true);
+ board_led_write(false);
+
+#if defined(BUTTON_PORT) && defined(BUTTON_PIN)
+ // Button
+ CLOCK_EnableClock(BUTTON_PIN_CLOCK);
+ port_pin_config_t button_port = {
+ .pullSelect = kPORT_PullUp,
+ .mux = BUTTON_PIN_FUNCTION,
+ };
+ PORT_SetPinConfig(BUTTON_PIN_PORT, BUTTON_PIN, &button_port);
+ gpio_pin_config_t button_config = { kGPIO_DigitalInput, 0 };
+ GPIO_PinInit(BUTTON_PORT, BUTTON_PIN, &button_config);
+#endif
// UART
CLOCK_EnableClock(UART_PIN_CLOCK);
@@ -119,6 +139,9 @@ void board_led_write(bool state)
uint32_t board_button_read(void)
{
+#if defined(BUTTON_PORT) && defined(BUTTON_PIN)
+ return BUTTON_STATE_ACTIVE == GPIO_ReadPinInput(BUTTON_PORT, BUTTON_PIN);
+#endif
return 0;
}