2010-10-25 09:03:38 +00:00
|
|
|
/** @file hal/micro/system-timer.h
|
|
|
|
* @brief Header file for system_timer APIs
|
2014-06-19 12:28:13 +00:00
|
|
|
*
|
2010-10-25 09:03:38 +00:00
|
|
|
*
|
|
|
|
* <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved. -->
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2013-08-10 12:31:43 +00:00
|
|
|
/**
|
|
|
|
* @addtogroup stm32w-cpu
|
|
|
|
* @{ */
|
|
|
|
|
2015-10-30 07:55:11 +00:00
|
|
|
/** @defgroup system_timer System Timer
|
2010-10-25 09:03:38 +00:00
|
|
|
* @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 15:57:08 +00:00
|
|
|
#ifndef SYSTEM_TIMER_H_
|
|
|
|
#define SYSTEM_TIMER_H_
|
2010-10-25 09:03:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Initializes the system tick.
|
|
|
|
*
|
2014-06-19 12:28:13 +00:00
|
|
|
* @return Time to update the async registers after RTC is started (units of 100
|
2010-10-25 09:03:38 +00:00
|
|
|
* microseconds).
|
|
|
|
*/
|
2013-03-15 15:14:09 +00:00
|
|
|
uint16_t halInternalStartSystemTimer(void);
|
2010-10-25 09:03:38 +00: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 15:14:09 +00:00
|
|
|
uint16_t halCommonGetInt16uMillisecondTick(void);
|
2010-10-25 09:03:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Returns the current system time in system ticks, as a 32-bit
|
|
|
|
* value.
|
|
|
|
*
|
2014-06-19 12:30:33 +00:00
|
|
|
* nostackusage
|
2010-10-25 09:03:38 +00:00
|
|
|
*
|
2014-06-19 12:28:13 +00:00
|
|
|
* @return The least significant 32 bits of the current system time, in
|
2010-10-25 09:03:38 +00:00
|
|
|
* system ticks.
|
|
|
|
*/
|
2013-03-15 15:14:09 +00:00
|
|
|
uint32_t halCommonGetInt32uMillisecondTick(void);
|
2010-10-25 09:03:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Returns the current system time in quarter second ticks, as a
|
|
|
|
* 16-bit value.
|
|
|
|
*
|
2014-06-19 12:30:33 +00:00
|
|
|
* nostackusage
|
2010-10-25 09:03:38 +00:00
|
|
|
*
|
|
|
|
* @return The least significant 16 bits of the current system time, in system
|
|
|
|
* ticks multiplied by 256.
|
|
|
|
*/
|
2013-03-15 15:14:09 +00:00
|
|
|
uint16_t halCommonGetInt16uQuarterSecondTick(void);
|
2010-10-25 09:03:38 +00:00
|
|
|
|
2013-11-24 15:57:08 +00:00
|
|
|
#endif //SYSTEM_TIMER_H_
|
2010-10-25 09:03:38 +00:00
|
|
|
|
2014-06-19 12:28:13 +00:00
|
|
|
/**@} //END addtogroup
|
2010-10-25 09:03:38 +00:00
|
|
|
*/
|
2013-08-10 12:31:43 +00:00
|
|
|
/** @} */
|
2010-10-25 09:03:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|