/**
 * \file    timer.c
 * \brief   SAL timer implimentation
 *
 * \par     Copyright (c) 2018 UWE Technologies Corp., Ltd. All Rights Reserved.
 * \author  James
 * \date    2018-03-12
 * \version 
 * 
 * \history 
 *  Date        Note
 *  2018-03-12  Original Creation
 * 
 */

#include "libc.h"
#include "drivers.h"


void timer_start(u32_t interval, volatile timer_t * timer)
{
    timer->interval = interval;
    timer->start = now();
}

int timer_expired(volatile timer_t * timer)
{
    return timer->interval ? ((u32_t)(now() - timer->start) >= timer->interval) : FALSE;
} 

