mirror of https://github.com/ARMmbed/mbed-os.git
BLE: Improve static constant of Range and Duration.
parent
62674e58e6
commit
e602a5f06c
|
@ -25,10 +25,8 @@ namespace ble {
|
||||||
|
|
||||||
template<uint32_t Min, uint32_t Max>
|
template<uint32_t Min, uint32_t Max>
|
||||||
struct Range {
|
struct Range {
|
||||||
enum {
|
static const uint32_t MIN = Min;
|
||||||
MIN = Min,
|
static const uint32_t MAX = Max;
|
||||||
MAX = Max
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Rep>
|
template<typename Rep>
|
||||||
|
@ -82,11 +80,9 @@ struct Duration {
|
||||||
return duration;
|
return duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum {
|
static const uint32_t TIME_BASE = TB;
|
||||||
TIME_BASE = TB,
|
static const Rep MIN = Range::MIN;
|
||||||
MIN = Range::MIN,
|
static const Rep MAX = Range::MAX;
|
||||||
MAX = Range::MAX
|
|
||||||
};
|
|
||||||
|
|
||||||
static Duration min()
|
static Duration min()
|
||||||
{
|
{
|
||||||
|
@ -270,10 +266,24 @@ bool operator>(Duration<Rep, Us, Range, F> lhs, Duration<Rep, Us, Range, F> rhs)
|
||||||
|
|
||||||
/* ---------------------- Static variable initialization -------------------- */
|
/* ---------------------- Static variable initialization -------------------- */
|
||||||
|
|
||||||
|
template<uint32_t Min, uint32_t Max>
|
||||||
|
const uint32_t Range<Min, Max>::MIN;
|
||||||
|
|
||||||
|
template<uint32_t Min, uint32_t Max>
|
||||||
|
const uint32_t Range<Min, Max>::MAX;
|
||||||
|
|
||||||
template<uint32_t V>
|
template<uint32_t V>
|
||||||
const uint32_t Forever<V>::VALUE;
|
const uint32_t Forever<V>::VALUE;
|
||||||
|
|
||||||
|
template<typename Rep, uint32_t TB, typename Range, typename Forever>
|
||||||
|
const uint32_t Duration<Rep, TB, Range, Forever>::TIME_BASE;
|
||||||
|
|
||||||
|
template<typename Rep, uint32_t TB, typename Range, typename Forever>
|
||||||
|
const Rep Duration<Rep, TB, Range, Forever>::MIN;
|
||||||
|
|
||||||
|
template<typename Rep, uint32_t TB, typename Range, typename Forever>
|
||||||
|
const Rep Duration<Rep, TB, Range, Forever>::MAX;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //BLE_COMMON_DURATION_H_
|
#endif //BLE_COMMON_DURATION_H_
|
||||||
|
|
Loading…
Reference in New Issue