/* Wait the specified number of ticks. 
This function delays for the given number of SysTick ticks. */
uint32_t am_hal_systick_wait_ticks(uint32_t u32Ticks)
/* Wait the specified number of ticks. 
This function delays for the given number of SysTick ticks. */
uint32_t am_hal_systick_wait_ticks(uint32_t u32Ticks)
{
    if ( u32Ticks == 0 )
    {
        u32Ticks++;
    }
    AM_REG(SYSTICK, SYSTRVR) = u32Ticks;
    AM_REG(SYSTICK, SYSTCVR) = 0x0;
    AM_REG(SYSTICK, SYSTCSR) = AM_REG_SYSTICK_SYSTCSR_ENABLE_M;
    while ( !(AM_REG(SYSTICK, SYSTCSR) & AM_REG_SYSTICK_SYSTCSR_COUNTFLAG_M) );
    AM_REG(SYSTICK, SYSTCSR) = 0;
    return 0;
}