2010-10-25 11:03:38 +02:00
|
|
|
/** @file hal/micro/system-timer.h
|
|
|
|
* @brief Header file for system_timer APIs
|
2014-06-19 14:28:13 +02:00
|
|
|
*
|
2010-10-25 11:03:38 +02:00
|
|
|
*
|
|
|
|
* <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved. -->
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** @addtogroup system_timer
|
|
|
|
* @brief Functions that provide access to the system clock.
|
|
|
|
*
|
|
|
|
* A single system tick (as returned by ::halCommonGetInt16uMillisecondTick() and
|
|
|
|
* ::halCommonGetInt32uMillisecondTick() ) is approximately 1 millisecond.
|
|
|
|
*
|
|
|
|
* - When used with a 32.768kHz crystal, the system tick is 0.976 milliseconds.
|
|
|
|
*
|
|
|
|
* - When used with a 3.6864MHz crystal, the system tick is 1.111 milliseconds.
|
|
|
|
*
|
|
|
|
* A single quarter-second tick (as returned by
|
|
|
|
* ::halCommonGetInt16uQuarterSecondTick() ) is approximately 0.25 seconds.
|
|
|
|
*
|
|
|
|
* The values used by the time support functions will wrap after an interval.
|
|
|
|
* The length of the interval depends on the length of the tick and the number
|
|
|
|
* of bits in the value. However, there is no issue when comparing time deltas
|
|
|
|
* of less than half this interval with a subtraction, if all data types are the
|
|
|
|
* same.
|
|
|
|
*
|
|
|
|
* See system-timer.h for source code.
|
|
|
|
*@{
|
|
|
|
*/
|
|
|
|
|
2013-11-24 16:57:08 +01:00
|
|
|
#ifndef SYSTEM_TIMER_H_
|
|
|
|
#define SYSTEM_TIMER_H_
|
2010-10-25 11:03:38 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Initializes the system tick.
|
|
|
|
*
|
2014-06-19 14:28:13 +02:00
|
|
|
* @return Time to update the async registers after RTC is started (units of 100
|
2010-10-25 11:03:38 +02:00
|
|
|
* microseconds).
|
|
|
|
*/
|
2013-03-15 16:14:09 +01:00
|
|
|
uint16_t halInternalStartSystemTimer(void);
|
2010-10-25 11:03:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Returns the current system time in system ticks, as a 16-bit
|
|
|
|
* value.
|
|
|
|
*
|
|
|
|
* @return The least significant 16 bits of the current system time, in system
|
|
|
|
* ticks.
|
|
|
|
*/
|
2013-03-15 16:14:09 +01:00
|
|
|
uint16_t halCommonGetInt16uMillisecondTick(void);
|
2010-10-25 11:03:38 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Returns the current system time in system ticks, as a 32-bit
|
|
|
|
* value.
|
|
|
|
*
|
2014-06-19 14:30:33 +02:00
|
|
|
* nostackusage
|
2010-10-25 11:03:38 +02:00
|
|
|
*
|
2014-06-19 14:28:13 +02:00
|
|
|
* @return The least significant 32 bits of the current system time, in
|
2010-10-25 11:03:38 +02:00
|
|
|
* system ticks.
|
|
|
|
*/
|
2013-03-15 16:14:09 +01:00
|
|
|
uint32_t halCommonGetInt32uMillisecondTick(void);
|
2010-10-25 11:03:38 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Returns the current system time in quarter second ticks, as a
|
|
|
|
* 16-bit value.
|
|
|
|
*
|
2014-06-19 14:30:33 +02:00
|
|
|
* nostackusage
|
2010-10-25 11:03:38 +02:00
|
|
|
*
|
|
|
|
* @return The least significant 16 bits of the current system time, in system
|
|
|
|
* ticks multiplied by 256.
|
|
|
|
*/
|
2013-03-15 16:14:09 +01:00
|
|
|
uint16_t halCommonGetInt16uQuarterSecondTick(void);
|
2010-10-25 11:03:38 +02:00
|
|
|
|
2013-11-24 16:57:08 +01:00
|
|
|
#endif //SYSTEM_TIMER_H_
|
2010-10-25 11:03:38 +02:00
|
|
|
|
2014-06-19 14:28:13 +02:00
|
|
|
/**@} //END addtogroup
|
2010-10-25 11:03:38 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|