clean up lpc13
This commit is contained in:
parent
f8ea10dc9a
commit
cea9abd4d0
|
@ -59,7 +59,6 @@
|
||||||
<folder Name="nxp">
|
<folder Name="nxp">
|
||||||
<folder Name="lpc_chip_13xx">
|
<folder Name="lpc_chip_13xx">
|
||||||
<folder Name="inc">
|
<folder Name="inc">
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/adc_13xx.h" />
|
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/chip.h" />
|
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/chip.h" />
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/clock_13xx.h" />
|
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/clock_13xx.h" />
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/cmsis.h" />
|
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/cmsis.h" />
|
||||||
|
@ -67,29 +66,13 @@
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/core_cm3.h" />
|
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/core_cm3.h" />
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/core_cmFunc.h" />
|
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/core_cmFunc.h" />
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/core_cmInstr.h" />
|
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/core_cmInstr.h" />
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/error.h" />
|
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/flash_13xx.h" />
|
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/fmc_13xx.h" />
|
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/gpio_13xx_1.h" />
|
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/gpio_13xx_1.h" />
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/gpio_13xx_2.h" />
|
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/gpio_13xx_2.h" />
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/gpiogroup_13xx.h" />
|
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/i2c_13xx.h" />
|
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/i2cm_13xx.h" />
|
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/iocon_13xx.h" />
|
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/iocon_13xx.h" />
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/lpc_types.h" />
|
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/lpc_types.h" />
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/pinint_13xx.h" />
|
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/pmu_13xx.h" />
|
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/ring_buffer.h" />
|
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/ritimer_13xx.h" />
|
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/romapi_13xx.h" />
|
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/ssp_13xx.h" />
|
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/stopwatch.h" />
|
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/sys_config.h" />
|
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/sys_config.h" />
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/sysctl_13xx.h" />
|
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/sysctl_13xx.h" />
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/timer_13xx.h" />
|
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/uart_13xx.h" />
|
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/uart_13xx.h" />
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/usbd_13xx.h" />
|
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/inc/wwdt_13xx.h" />
|
|
||||||
</folder>
|
</folder>
|
||||||
<folder Name="src">
|
<folder Name="src">
|
||||||
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/src/chip_13xx.c" />
|
<file file_name="../../../../../hw/mcu/nxp/lpc_chip_13xx/src/chip_13xx.c" />
|
||||||
|
|
|
@ -201,7 +201,7 @@ void led_blinking_task(void)
|
||||||
if ( !tu_timeout_expired(&tm) ) return; // not enough time
|
if ( !tu_timeout_expired(&tm) ) return; // not enough time
|
||||||
tu_timeout_reset(&tm);
|
tu_timeout_reset(&tm);
|
||||||
|
|
||||||
board_led_control(BOARD_LED0, led_state);
|
board_led_control(led_state);
|
||||||
led_state = 1 - led_state; // toggle
|
led_state = 1 - led_state; // toggle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ void led_blinky_cb(TimerHandle_t xTimer)
|
||||||
(void) xTimer;
|
(void) xTimer;
|
||||||
static bool led_state = false;
|
static bool led_state = false;
|
||||||
|
|
||||||
board_led_control(BOARD_LED0, led_state);
|
board_led_control(led_state);
|
||||||
led_state = 1 - led_state; // toggle
|
led_state = 1 - led_state; // toggle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ tusb_error_t led_blinking_subtask(void)
|
||||||
|
|
||||||
osal_task_delay(led_blink_interval_ms);
|
osal_task_delay(led_blink_interval_ms);
|
||||||
|
|
||||||
board_led_control(BOARD_LED0, led_state);
|
board_led_control(led_state);
|
||||||
led_state = 1 - led_state; // toggle
|
led_state = 1 - led_state; // toggle
|
||||||
|
|
||||||
// uint32_t btn_mask;
|
// uint32_t btn_mask;
|
||||||
|
|
|
@ -40,10 +40,8 @@
|
||||||
|
|
||||||
#include "../board.h"
|
#include "../board.h"
|
||||||
|
|
||||||
#define LED_PORT (0)
|
#define LED_PORT 0
|
||||||
#define LED_PIN (7)
|
#define LED_PIN 7
|
||||||
#define LED_ON (1)
|
|
||||||
#define LED_OFF (0)
|
|
||||||
|
|
||||||
const static struct {
|
const static struct {
|
||||||
uint8_t port;
|
uint8_t port;
|
||||||
|
@ -63,38 +61,41 @@ enum {
|
||||||
BOARD_BUTTON_COUNT = sizeof(buttons) / sizeof(buttons[0])
|
BOARD_BUTTON_COUNT = sizeof(buttons) / sizeof(buttons[0])
|
||||||
};
|
};
|
||||||
|
|
||||||
// required by lpcopen chip layer
|
/* System oscillator rate and RTC oscillator rate */
|
||||||
const uint32_t OscRateIn = 12000000;
|
const uint32_t OscRateIn = 12000000;
|
||||||
const uint32_t ExtRateIn = 0;
|
const uint32_t ExtRateIn = 0;
|
||||||
|
|
||||||
/* Pin muxing table, only items that need changing from their default pin
|
/* Pin muxing table, only items that need changing from their default pin
|
||||||
state are in this table. */
|
state are in this table. */
|
||||||
static const PINMUX_GRP_T pinmuxing[] = {
|
static const PINMUX_GRP_T pinmuxing[] =
|
||||||
{0, 1, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_INACT)}, /* PIO0_1 used for CLKOUT */
|
{
|
||||||
{0, 2, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_PULLUP)}, /* PIO0_2 used for SSEL */
|
{0, 1, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_INACT)}, /* PIO0_1 used for CLKOUT */
|
||||||
{0, 3, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_INACT)}, /* PIO0_3 used for USB_VBUS */
|
{0, 2, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_PULLUP)}, /* PIO0_2 used for SSEL */
|
||||||
{0, 4, (IOCON_FUNC1 | IOCON_FASTI2C_EN)}, /* PIO0_4 used for SCL */
|
{0, 3, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_INACT)}, /* PIO0_3 used for USB_VBUS */
|
||||||
{0, 5, (IOCON_FUNC1 | IOCON_FASTI2C_EN)}, /* PIO0_5 used for SDA */
|
{0, 4, (IOCON_FUNC1 | IOCON_FASTI2C_EN)}, /* PIO0_4 used for SCL */
|
||||||
{0, 6, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_INACT)}, /* PIO0_6 used for USB_CONNECT */
|
{0, 5, (IOCON_FUNC1 | IOCON_FASTI2C_EN)}, /* PIO0_5 used for SDA */
|
||||||
{0, 8, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_INACT)}, /* PIO0_8 used for MISO0 */
|
{0, 6, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_INACT)}, /* PIO0_6 used for USB_CONNECT */
|
||||||
{0, 9, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_INACT)}, /* PIO0_9 used for MOSI0 */
|
{0, 8, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_INACT)}, /* PIO0_8 used for MISO0 */
|
||||||
{0, 11, (IOCON_FUNC2 | IOCON_ADMODE_EN | IOCON_FILT_DIS)}, /* PIO0_11 used for AD0 */
|
{0, 9, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_INACT)}, /* PIO0_9 used for MOSI0 */
|
||||||
{0, 18, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_INACT)}, /* PIO0_18 used for RXD */
|
{0, 11, (IOCON_FUNC2 | IOCON_ADMODE_EN | IOCON_FILT_DIS)}, /* PIO0_11 used for AD0 */
|
||||||
{0, 19, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_INACT)}, /* PIO0_19 used for TXD */
|
{0, 18, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_INACT)}, /* PIO0_18 used for RXD */
|
||||||
{1, 29, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_INACT)}, /* PIO1_29 used for SCK0 */
|
{0, 19, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_INACT)}, /* PIO0_19 used for TXD */
|
||||||
|
{1, 29, (IOCON_FUNC1 | IOCON_RESERVED_BIT_7 | IOCON_MODE_INACT)}, /* PIO1_29 used for SCK0 */
|
||||||
};
|
};
|
||||||
|
|
||||||
// Invoked by startup code
|
// Invoked by startup code
|
||||||
void SystemInit(void)
|
void SystemInit(void)
|
||||||
{
|
{
|
||||||
/* Enable IOCON clock */
|
/* Enable IOCON clock */
|
||||||
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
|
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
|
||||||
Chip_IOCON_SetPinMuxing(LPC_IOCON, pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));
|
Chip_IOCON_SetPinMuxing(LPC_IOCON, pinmuxing, sizeof(pinmuxing) / sizeof(PINMUX_GRP_T));
|
||||||
Chip_SetupXtalClocking();
|
Chip_SetupXtalClocking();
|
||||||
}
|
}
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
|
SystemCoreClockUpdate();
|
||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||||
SysTick_Config(SystemCoreClock / BOARD_TICKS_HZ); // 1 msec tick timer
|
SysTick_Config(SystemCoreClock / BOARD_TICKS_HZ); // 1 msec tick timer
|
||||||
#endif
|
#endif
|
||||||
|
@ -102,7 +103,7 @@ void board_init(void)
|
||||||
Chip_GPIO_Init(LPC_GPIO_PORT);
|
Chip_GPIO_Init(LPC_GPIO_PORT);
|
||||||
|
|
||||||
//------------- LED -------------//
|
//------------- LED -------------//
|
||||||
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 0, BOARD_LED0);
|
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, LED_PORT, LED_PIN);
|
||||||
|
|
||||||
//------------- BUTTON -------------//
|
//------------- BUTTON -------------//
|
||||||
// for(uint8_t i=0; i<BOARD_BUTTON_COUNT; i++) GPIOSetDir(buttons[i].port, BIT_(buttons[i].pin), 0);
|
// for(uint8_t i=0; i<BOARD_BUTTON_COUNT; i++) GPIOSetDir(buttons[i].port, BIT_(buttons[i].pin), 0);
|
||||||
|
@ -134,15 +135,9 @@ uint32_t tusb_hal_millis(void)
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// LEDS
|
// LEDS
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void board_led_control(uint32_t id, bool state)
|
void board_led_control(bool state)
|
||||||
{
|
{
|
||||||
if (state)
|
Chip_GPIO_SetPinState(LPC_GPIO_PORT, LED_PORT, LED_PIN, state);
|
||||||
{
|
|
||||||
Chip_GPIO_SetValue(LPC_GPIO_PORT, 0, 1 << id);
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
Chip_GPIO_ClearValue(LPC_GPIO_PORT, 0, 1 << id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
|
|
@ -45,8 +45,6 @@
|
||||||
|
|
||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
|
|
||||||
#define BOARD_LED0 7
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue