mcb1800 build and blinky with makefile
This commit is contained in:
@@ -30,24 +30,28 @@
|
||||
#define LED_PORT 6
|
||||
#define LED_PIN 24
|
||||
|
||||
#define BUTTON_PORT 4
|
||||
#define BUTTON_PIN 0
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
|
||||
//--------------------------------------------------------------------+
|
||||
/* System configuration variables used by chip driver */
|
||||
const uint32_t ExtRateIn = 0;
|
||||
const uint32_t OscRateIn = 12000000;
|
||||
const uint32_t ExtRateIn = 0;
|
||||
|
||||
static const PINMUX_GRP_T pinmuxing[] =
|
||||
{
|
||||
/* Board LEDs */
|
||||
{0xD, 10, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4)},
|
||||
{0xD, 11, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4)},
|
||||
{0xD, 12, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4)},
|
||||
{0xD, 13, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4)},
|
||||
{0xD, 14, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4)},
|
||||
{0x9, 0, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0)},
|
||||
{0x9, 1, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0)},
|
||||
{0x9, 2, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0)},
|
||||
{0xD, 11, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4 | SCU_MODE_PULLDOWN)},
|
||||
{0xD, 12, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4 | SCU_MODE_PULLDOWN)},
|
||||
{0xD, 13, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4 | SCU_MODE_PULLDOWN)},
|
||||
{0xD, 14, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC4 | SCU_MODE_PULLDOWN)},
|
||||
{0x9, 0, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0 | SCU_MODE_PULLDOWN)},
|
||||
{0x9, 1, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0 | SCU_MODE_PULLDOWN)},
|
||||
{0x9, 2, (SCU_MODE_INBUFF_EN | SCU_MODE_INACT | SCU_MODE_FUNC0 | SCU_MODE_PULLDOWN)},
|
||||
|
||||
/* I2S */
|
||||
{0x3, 0, (SCU_PINIO_FAST | SCU_MODE_FUNC2)},
|
||||
@@ -67,10 +71,6 @@ static const PINMUX_GRP_T pinclockmuxing[] =
|
||||
{0, 3, (SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_ZIF_DIS | SCU_MODE_HIGHSPEEDSLEW_EN | SCU_MODE_FUNC0)},
|
||||
};
|
||||
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* BOARD API
|
||||
*------------------------------------------------------------------*/
|
||||
// Invoked by startup code
|
||||
void SystemInit(void)
|
||||
{
|
||||
@@ -97,25 +97,13 @@ void board_init(void)
|
||||
|
||||
Chip_GPIO_Init(LPC_GPIO_PORT);
|
||||
|
||||
//------------- LED -------------//
|
||||
/* Port and bit mapping for LEDs on GPIOs */
|
||||
const uint8_t ledports[] = {6, 6, 6, 6, 6, 4, 4, 4};
|
||||
const uint8_t ledbits[] = {24, 25, 26, 27, 28, 12, 13, 14};
|
||||
// LED
|
||||
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, LED_PORT, LED_PIN);
|
||||
|
||||
for (uint32_t i = 0; i < (sizeof(ledports) / sizeof(ledports[0])); i++)
|
||||
{
|
||||
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, ledports[i], ledbits[i]);
|
||||
Chip_GPIO_SetPinState(LPC_GPIO_PORT, LED_PORT, LED_PIN, false);
|
||||
}
|
||||
// Button
|
||||
Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, BUTTON_PORT, BUTTON_PIN);
|
||||
|
||||
#if 0
|
||||
//------------- BUTTON -------------//
|
||||
for(uint8_t i=0; i<BOARD_BUTTON_COUNT; i++)
|
||||
{
|
||||
scu_pinmux(buttons[i].mux_port, buttons[i].mux_pin, GPIO_NOPULL, FUNC0);
|
||||
GPIO_SetDir(buttons[i].gpio_port, TU_BIT(buttons[i].gpio_pin), 0);
|
||||
}
|
||||
|
||||
//------------- UART -------------//
|
||||
scu_pinmux(BOARD_UART_PIN_PORT, BOARD_UART_PIN_TX, MD_PDN, FUNC1);
|
||||
scu_pinmux(BOARD_UART_PIN_PORT, BOARD_UART_PIN_RX, MD_PLN | MD_EZI | MD_ZI, FUNC1);
|
||||
@@ -177,22 +165,28 @@ void board_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------- LED -------------//
|
||||
//--------------------------------------------------------------------+
|
||||
// Board porting API
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||
volatile uint32_t system_ticks = 0;
|
||||
void SysTick_Handler (void)
|
||||
{
|
||||
system_ticks++;
|
||||
}
|
||||
|
||||
uint32_t board_millis(void)
|
||||
{
|
||||
return system_ticks;
|
||||
}
|
||||
#endif
|
||||
|
||||
void board_led_write(bool state)
|
||||
{
|
||||
Chip_GPIO_SetPinState(LPC_GPIO_PORT, LED_PORT, LED_PIN, state);
|
||||
}
|
||||
|
||||
//------------- Buttons -------------//
|
||||
/*
|
||||
static bool button_read(uint8_t id)
|
||||
{
|
||||
(void) id;
|
||||
// return !tu_bit_test( GPIO_ReadValue(buttons[id].gpio_port), buttons[id].gpio_pin ); // button is active low
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
uint32_t board_button_read(void)
|
||||
{
|
||||
uint32_t result = 0;
|
||||
@@ -203,7 +197,6 @@ uint32_t board_button_read(void)
|
||||
}
|
||||
|
||||
|
||||
//------------- UART -------------//
|
||||
int board_uart_read(uint8_t* buf, int len)
|
||||
{
|
||||
//return UART_ReceiveByte(BOARD_UART_PORT);
|
||||
@@ -220,21 +213,4 @@ int board_uart_write(void const * buf, int len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* TUSB HAL MILLISECOND
|
||||
*------------------------------------------------------------------*/
|
||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||
|
||||
volatile uint32_t system_ticks = 0;
|
||||
|
||||
void SysTick_Handler (void)
|
||||
{
|
||||
system_ticks++;
|
||||
}
|
||||
|
||||
uint32_t board_millis(void)
|
||||
{
|
||||
return system_ticks;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user