78 lines
2.0 KiB
C
78 lines
2.0 KiB
C
/*
|
|
* Copyright 2019 NXP
|
|
* All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include "pin_mux.h"
|
|
#include "board.h"
|
|
|
|
#include "fsl_power.h"
|
|
/*******************************************************************************
|
|
* Definitions
|
|
******************************************************************************/
|
|
#define BOARD_LED_PORT BOARD_LED_BLUE_GPIO_PORT
|
|
#define BOARD_LED_PIN BOARD_LED_BLUE_GPIO_PIN
|
|
|
|
/*******************************************************************************
|
|
* Prototypes
|
|
******************************************************************************/
|
|
|
|
/*******************************************************************************
|
|
* Variables
|
|
******************************************************************************/
|
|
volatile uint32_t g_systickCounter;
|
|
|
|
/*******************************************************************************
|
|
* Code
|
|
******************************************************************************/
|
|
void SysTick_Handler(void)
|
|
{
|
|
if (g_systickCounter != 0U)
|
|
{
|
|
g_systickCounter--;
|
|
}
|
|
}
|
|
|
|
void SysTick_DelayTicks(uint32_t n)
|
|
{
|
|
g_systickCounter = n;
|
|
while (g_systickCounter != 0U)
|
|
{
|
|
}
|
|
}
|
|
|
|
/*!
|
|
* @brief Main function
|
|
*/
|
|
int main(void)
|
|
{
|
|
/* Init output LED GPIO. */
|
|
GPIO_PortInit(GPIO, BOARD_LED_PORT);
|
|
/* Board pin init */
|
|
/* set BOD VBAT level to 1.65V */
|
|
POWER_SetBodVbatLevel(kPOWER_BodVbatLevel1650mv, kPOWER_BodHystLevel50mv, false);
|
|
BOARD_InitBootPins();
|
|
SystemCoreClockUpdate();
|
|
#if !defined(DONT_ENABLE_FLASH_PREFETCH)
|
|
/* enable flash prefetch for better performance */
|
|
SYSCON->FMCCR |= SYSCON_FMCCR_PREFEN_MASK;
|
|
#endif
|
|
|
|
/* Set systick reload value to generate 1ms interrupt */
|
|
if (SysTick_Config(SystemCoreClock / 1000U))
|
|
{
|
|
while (1)
|
|
{
|
|
}
|
|
}
|
|
|
|
while (1)
|
|
{
|
|
/* Delay 1000 ms */
|
|
SysTick_DelayTicks(1000U);
|
|
GPIO_PortToggle(GPIO, BOARD_LED_PORT, 1u << BOARD_LED_PIN);
|
|
}
|
|
}
|