summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Steiert <[email protected]>2021-08-23 16:36:58 -0700
committerGreg Steiert <[email protected]>2021-08-23 16:36:58 -0700
commit5bd7788950c8e7118d2394e7821f0486ca66aaab (patch)
tree19a16e72364d257c283932ddbc6b788fa47ccda1
parent86201f77be1c2fc058f7896b99d6069b4b0b12a5 (diff)
cleaned up unused code, only enalbing port clocks as needed
-rw-r--r--hw/bsp/frdm_k32l2b/board.h8
-rw-r--r--hw/bsp/frdm_k32l2b/frdm_k32l2b.c42
2 files changed, 7 insertions, 43 deletions
diff --git a/hw/bsp/frdm_k32l2b/board.h b/hw/bsp/frdm_k32l2b/board.h
index 60bc03fbd..825367915 100644
--- a/hw/bsp/frdm_k32l2b/board.h
+++ b/hw/bsp/frdm_k32l2b/board.h
@@ -31,16 +31,14 @@
#include "fsl_device_registers.h"
// LED
-//#define LED_PINMUX IOMUXC_GPIO_11_GPIOMUX_IO11
-//#define LED_PIN_CLOCK kCLOCK_PortB
+#define LED_PIN_CLOCK kCLOCK_PortD
#define LED_GPIO GPIOD
#define LED_PORT PORTD
#define LED_PIN 5
#define LED_STATE_ON 0
// SW3 button1
-//#define BUTTON_PINMUX IOMUXC_GPIO_SD_05_GPIO2_IO05
-//#define BUTTON_PIN_CLOCK kCLOCK_PortC
+#define BUTTON_PIN_CLOCK kCLOCK_PortC
#define BUTTON_GPIO GPIOC
#define BUTTON_PORT PORTC
#define BUTTON_PIN 3
@@ -48,7 +46,7 @@
// UART
#define UART_PORT LPUART0
-//#define UART_PIN_CLOCK kCLOCK_PortA
+#define UART_PIN_CLOCK kCLOCK_PortA
#define UART_PIN_PORT PORTA
#define UART_PIN_RX 1u
#define UART_PIN_TX 2u
diff --git a/hw/bsp/frdm_k32l2b/frdm_k32l2b.c b/hw/bsp/frdm_k32l2b/frdm_k32l2b.c
index c5e92d37d..c45095caa 100644
--- a/hw/bsp/frdm_k32l2b/frdm_k32l2b.c
+++ b/hw/bsp/frdm_k32l2b/frdm_k32l2b.c
@@ -42,44 +42,12 @@ void USB0_IRQHandler(void)
tud_int_handler(0);
}
-//--------------------------------------------------------------------+
-// MACRO TYPEDEF CONSTANT ENUM DECLARATION
-//--------------------------------------------------------------------+
-// LED
-/*
-//#define LED_PINMUX IOMUXC_GPIO_AD_B0_09_GPIO1_IO09
-#define LED_PORT GPIOB
-#define LED_PIN_CLOCK kCLOCK_PortD
-#define LED_PIN_PORT PORTD
-#define LED_PIN 5U
-#define LED_PIN_FUNCTION kPORT_MuxAsGpio
-#define LED_STATE_ON 0
-
-// UART
-#define UART_PORT LPUART0
-#define UART_PIN_CLOCK kCLOCK_PortA
-#define UART_PIN_PORT PORTA
-#define UART_PIN_RX 1u
-#define UART_PIN_TX 2u
-#define UART_PIN_FUNCTION kPORT_MuxAlt2
-*/
-//#define SOPT5_UART0RXSRC_UART_RX 0x00u /*!< UART0 receive data source select: UART0_RX pin */
-//#define SOPT5_UART0TXSRC_UART_TX 0x00u /*!< UART0 transmit data source select: UART0_TX pin */
-
-//const uint8_t dcd_data[] = { 0x00 };
-
void board_init(void)
{
- /* Port A Clock Gate Control: Clock enabled */
- CLOCK_EnableClock(kCLOCK_PortA);
- /* Port B Clock Gate Control: Clock enabled */
- CLOCK_EnableClock(kCLOCK_PortB);
- /* Port C Clock Gate Control: Clock enabled */
- CLOCK_EnableClock(kCLOCK_PortC);
- /* Port D Clock Gate Control: Clock enabled */
- CLOCK_EnableClock(kCLOCK_PortD);
- /* Port E Clock Gate Control: Clock enabled */
- CLOCK_EnableClock(kCLOCK_PortE);
+ /* Enable port clocks for UART/LED/Button pins */
+ CLOCK_EnableClock(UART_PIN_CLOCK);
+ CLOCK_EnableClock(LED_PIN_CLOCK);
+ CLOCK_EnableClock(BUTTON_PIN_CLOCK);
gpio_pin_config_t led_config = { kGPIO_DigitalOutput, 0 };
GPIO_PinInit(LED_GPIO, LED_PIN, &led_config);
@@ -129,9 +97,7 @@ void board_init(void)
LPUART_Init(UART_PORT, &uart_config, CLOCK_GetFreq(kCLOCK_McgIrc48MClk));
// USB
-// SystemCoreClockUpdate();
CLOCK_EnableUsbfs0Clock(kCLOCK_UsbSrcIrc48M, 48000000U);
-// CLOCK_EnableUsbfs0Clock(kCLOCK_UsbSrcPll0, CLOCK_GetFreq(kCLOCK_PllFllSelClk));
}
//--------------------------------------------------------------------+