/*
 * systick.h
 *
 *  Created on: 2017. júl. 22.
 *      Author: win7
 */

#ifndef SYSTICK_H_
#define SYSTICK_H_
#include "stdint.h"
#include "LPC8xx.h"
//#include "rom_api.h"

#define LPC_MAX_DELAY 0xFFFFFFFFU

__STATIC_INLINE void LPC_InitTick(uint32_t HCLKFrequency, uint32_t Ticks)

{
  /* Configure the SysTick to have interrupt in 1ms time base */
  SysTick->LOAD  = (uint32_t) ((HCLKFrequency / Ticks) - 1UL);  /* set reload register */
  SysTick->VAL   = 0UL;                                       /* Load the SysTick Counter Value */
  SysTick->CTRL  = SysTick_CTRL_CLKSOURCE_Msk |
                   SysTick_CTRL_ENABLE_Msk;                   /* Enable the Systick Timer */
}


void LPC_Init1msTick(uint32_t HCLKFrequency);
void LPC_mDelay(uint32_t Delay);

#endif /* SYSTICK_H_ */
