/*
 * systick.c
 *
 *  Created on: 2017. júl. 22.
 *      Author: win7
 */


#include"systick.h"

__STATIC_INLINE void LPC_InitTick(uint32_t HCLKFrequency, uint32_t Ticks);

void LPC_Init1msTick(uint32_t HCLKFrequency)
{
  /* Use frequency provided in argument */
  LPC_InitTick(HCLKFrequency, 1000U);
}


void LPC_mDelay(uint32_t Delay)
{
  __IO uint32_t  tmp = SysTick->CTRL;  /* Clear the COUNTFLAG first */
  /* Add this code to indicate that local variable is not used */
  ((void)tmp);

  /* Add a period to guaranty minimum wait */
  if (Delay < LPC_MAX_DELAY)
  {
    Delay++;
  }

  while (Delay)
  {
    if ((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) != 0U)
    {
      Delay--;
    }
  }
}
