Move time macro conversions to `Ticker.h`

pull/11236/head
Hugues Kamba 2019-08-15 15:22:50 +01:00
parent 4b1cee3cf3
commit ce5dbda1ba
2 changed files with 15 additions and 15 deletions

View File

@ -23,6 +23,21 @@
#include "platform/NonCopyable.h"
#include "hal/lp_ticker_api.h"
/**
* Number of microseconds in a second
*/
#define MICROSECONDS_IN_SECOND (us_timestamp_t)1000000
/**
* Converts seconds to microseconds
*/
#define SECONDS_TO_MICROSECONDS(SECONDS) (us_timestamp_t)(MICROSECONDS_IN_SECOND * SECONDS)
/**
* Converts microseconds to seconds
*/
#define MICROSECONDS_TO_SECONDS(MICROSECONDS) (s_timestamp_t)(MICROSECONDS / MICROSECONDS_IN_SECOND)
namespace mbed {
/**
* \addtogroup drivers_Ticker Ticker class

View File

@ -24,21 +24,6 @@
#include <stdbool.h>
#include "device.h"
/**
* Number of microseconds in a second
*/
#define MICROSECONDS_IN_SECOND (us_timestamp_t)1000000
/**
* Converts seconds to microseconds
*/
#define SECONDS_TO_MICROSECONDS(SECONDS) (us_timestamp_t)(MICROSECONDS_IN_SECOND * SECONDS)
/**
* Converts microseconds to seconds
*/
#define MICROSECONDS_TO_SECONDS(MICROSECONDS) (s_timestamp_t)(MICROSECONDS / MICROSECONDS_IN_SECOND)
/**
* Legacy format representing a timestamp in us.
* Given it is modeled as a 32 bit integer, this type can represent timestamp