Explorar el Código

fix lpc54 button

hathach hace 4 años
padre
commit
8a9f412788

+ 2 - 0
hw/bsp/lpc54/boards/lpcxpresso54114/board.mk

@@ -4,6 +4,8 @@ MCU_CORE = LPC54114_cm4
 CFLAGS += -DCPU_LPC54114J256BD64_cm4
 CFLAGS += -DCPU_LPC54114J256BD64_cm4
 LD_FILE = $(MCU_DIR)/gcc/LPC54114J256_cm4_flash.ld
 LD_FILE = $(MCU_DIR)/gcc/LPC54114J256_cm4_flash.ld
 
 
+LIBS += $(TOP)/$(MCU_DIR)/gcc/libpower_cm4_hardabi.a
+
 JLINK_DEVICE = LPC54114J256_M4
 JLINK_DEVICE = LPC54114J256_M4
 PYOCD_TARGET = LPC54114
 PYOCD_TARGET = LPC54114
 
 

+ 4 - 4
hw/bsp/lpc54/family.c

@@ -100,9 +100,6 @@ void board_init(void)
   // Enable IOCON clock
   // Enable IOCON clock
   CLOCK_EnableClock(kCLOCK_Iocon);
   CLOCK_EnableClock(kCLOCK_Iocon);
 
 
-  // Enable GPIO0 clock
-  CLOCK_EnableClock(kCLOCK_Gpio0);
-
   // Init 96 MHz clock
   // Init 96 MHz clock
   BootClockFROHF96M();
   BootClockFROHF96M();
 
 
@@ -114,16 +111,19 @@ void board_init(void)
   NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
   NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
 #endif
 #endif
 
 
-  // Init all GPIO ports
+  // Init all GPIO ports 54114 only has 2 ports.
   GPIO_PortInit(GPIO, 0);
   GPIO_PortInit(GPIO, 0);
   GPIO_PortInit(GPIO, 1);
   GPIO_PortInit(GPIO, 1);
+  //GPIO_PortInit(GPIO, 2);
 
 
   // LED
   // LED
+  IOCON_PinMuxSet(IOCON, LED_PORT, LED_PIN, IOCON_PIO_DIG_FUNC0_EN);
   gpio_pin_config_t const led_config = { kGPIO_DigitalOutput, 0};
   gpio_pin_config_t const led_config = { kGPIO_DigitalOutput, 0};
   GPIO_PinInit(GPIO, LED_PORT, LED_PIN, &led_config);
   GPIO_PinInit(GPIO, LED_PORT, LED_PIN, &led_config);
   board_led_write(true);
   board_led_write(true);
 
 
   // Button
   // Button
+  IOCON_PinMuxSet(IOCON, BUTTON_PORT, BUTTON_PIN, IOCON_PIO_DIG_FUNC0_EN | IOCON_PIO_MODE_PULLUP);
   gpio_pin_config_t const button_config = { kGPIO_DigitalInput, 0};
   gpio_pin_config_t const button_config = { kGPIO_DigitalInput, 0};
   GPIO_PinInit(GPIO, BUTTON_PORT, BUTTON_PIN, &button_config);
   GPIO_PinInit(GPIO, BUTTON_PORT, BUTTON_PIN, &button_config);
 
 

+ 0 - 3
hw/bsp/lpc54/family.mk

@@ -11,7 +11,6 @@ CFLAGS += \
   -mfloat-abi=hard \
   -mfloat-abi=hard \
   -mfpu=fpv4-sp-d16 \
   -mfpu=fpv4-sp-d16 \
   -DCFG_TUSB_MCU=OPT_MCU_LPC54XXX \
   -DCFG_TUSB_MCU=OPT_MCU_LPC54XXX \
-  -DCFG_TUSB_MEM_SECTION='__attribute__((section(".data")))' \
   -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))' 
   -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))' 
 
 
 # mcu driver cause following warnings
 # mcu driver cause following warnings
@@ -41,7 +40,5 @@ INC += \
 
 
 SRC_S += $(MCU_DIR)/gcc/startup_$(MCU_CORE).S
 SRC_S += $(MCU_DIR)/gcc/startup_$(MCU_CORE).S
 
 
-LIBS += $(TOP)/$(MCU_DIR)/gcc/libpower_cm4_hardabi.a
-
 # For freeRTOS port source
 # For freeRTOS port source
 FREERTOS_PORT = ARM_CM4F
 FREERTOS_PORT = ARM_CM4F