mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-12 01:25:59 +00:00
Added time functions
This commit is contained in:
parent
71ba6af7e1
commit
0fc3f71d5a
28
include/sta/devices/arduino/time.hpp
Normal file
28
include/sta/devices/arduino/time.hpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#ifndef STA_DEVICES_ARDUINO_TIME_HPP
|
||||||
|
#define STA_DEVICES_ARDUINO_TIME_HPP
|
||||||
|
|
||||||
|
#include <sta/config.hpp>
|
||||||
|
#ifdef STA_PLATFORM_ARDUINO
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace sta
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @brief The current time in milliseconds.
|
||||||
|
*
|
||||||
|
* @return uint32_t Returns current time in milliseconds.
|
||||||
|
*/
|
||||||
|
uint32_t now();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The current time in microseconds.
|
||||||
|
*
|
||||||
|
* @return uint32_t Returns the current time in microseconds.
|
||||||
|
*/
|
||||||
|
uint32_t nowUs();
|
||||||
|
} // namespace sta
|
||||||
|
|
||||||
|
#endif // STA_PLATFORM_ARDUINO
|
||||||
|
|
||||||
|
#endif // STA_DEVICES_ARDUINO_TIME_HPP
|
19
src/devices/arduino/time.cpp
Normal file
19
src/devices/arduino/time.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include <sta/devices/arduino/time.hpp>
|
||||||
|
|
||||||
|
#ifdef STA_PLATFORM_ARDUINO
|
||||||
|
#include <sta/devices/arduino/hal.hpp>
|
||||||
|
|
||||||
|
namespace sta
|
||||||
|
{
|
||||||
|
uint32_t now()
|
||||||
|
{
|
||||||
|
return millis();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t nowUs()
|
||||||
|
{
|
||||||
|
return micros();
|
||||||
|
}
|
||||||
|
} // namespace sta
|
||||||
|
|
||||||
|
#endif // STA_PLATFORM_ARDUINO
|
Loading…
x
Reference in New Issue
Block a user