this is using the mbed os version 5-13-1
source/Duration.h@75:08eff6258e1b, 2019-03-14 (annotated)
- Committer:
- ocomeni
- Date:
- Thu Mar 14 21:34:06 2019 +0000
- Revision:
- 75:08eff6258e1b
Ble Security example now working!
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ocomeni | 75:08eff6258e1b | 1 | /* mbed Microcontroller Library |
| ocomeni | 75:08eff6258e1b | 2 | * Copyright (c) 2018 ARM Limited |
| ocomeni | 75:08eff6258e1b | 3 | * |
| ocomeni | 75:08eff6258e1b | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| ocomeni | 75:08eff6258e1b | 5 | * you may not use this file except in compliance with the License. |
| ocomeni | 75:08eff6258e1b | 6 | * You may obtain a copy of the License at |
| ocomeni | 75:08eff6258e1b | 7 | * |
| ocomeni | 75:08eff6258e1b | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| ocomeni | 75:08eff6258e1b | 9 | * |
| ocomeni | 75:08eff6258e1b | 10 | * Unless required by applicable law or agreed to in writing, software |
| ocomeni | 75:08eff6258e1b | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| ocomeni | 75:08eff6258e1b | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| ocomeni | 75:08eff6258e1b | 13 | * See the License for the specific language governing permissions and |
| ocomeni | 75:08eff6258e1b | 14 | * limitations under the License. |
| ocomeni | 75:08eff6258e1b | 15 | */ |
| ocomeni | 75:08eff6258e1b | 16 | |
| ocomeni | 75:08eff6258e1b | 17 | #ifndef BLE_COMMON_DURATION_H_ |
| ocomeni | 75:08eff6258e1b | 18 | #define BLE_COMMON_DURATION_H_ |
| ocomeni | 75:08eff6258e1b | 19 | |
| ocomeni | 75:08eff6258e1b | 20 | #include <stdint.h> |
| ocomeni | 75:08eff6258e1b | 21 | #include <stddef.h> |
| ocomeni | 75:08eff6258e1b | 22 | #include "platform/mbed_assert.h" |
| ocomeni | 75:08eff6258e1b | 23 | |
| ocomeni | 75:08eff6258e1b | 24 | namespace ble { |
| ocomeni | 75:08eff6258e1b | 25 | |
| ocomeni | 75:08eff6258e1b | 26 | #if !defined(DOXYGEN_ONLY) |
| ocomeni | 75:08eff6258e1b | 27 | |
| ocomeni | 75:08eff6258e1b | 28 | /** |
| ocomeni | 75:08eff6258e1b | 29 | * Define a compile time range. |
| ocomeni | 75:08eff6258e1b | 30 | * @tparam Min left-bound |
| ocomeni | 75:08eff6258e1b | 31 | * @tparam Max right-bound |
| ocomeni | 75:08eff6258e1b | 32 | */ |
| ocomeni | 75:08eff6258e1b | 33 | template<uint32_t Min, uint32_t Max> |
| ocomeni | 75:08eff6258e1b | 34 | struct Range { |
| ocomeni | 75:08eff6258e1b | 35 | static const uint32_t MIN = Min; |
| ocomeni | 75:08eff6258e1b | 36 | static const uint32_t MAX = Max; |
| ocomeni | 75:08eff6258e1b | 37 | }; |
| ocomeni | 75:08eff6258e1b | 38 | |
| ocomeni | 75:08eff6258e1b | 39 | /** |
| ocomeni | 75:08eff6258e1b | 40 | * Deduce default range for C++ basic integer types. |
| ocomeni | 75:08eff6258e1b | 41 | * |
| ocomeni | 75:08eff6258e1b | 42 | * |
| ocomeni | 75:08eff6258e1b | 43 | * @tparam Rep The C++ integer type. |
| ocomeni | 75:08eff6258e1b | 44 | */ |
| ocomeni | 75:08eff6258e1b | 45 | template<typename Rep> |
| ocomeni | 75:08eff6258e1b | 46 | struct DefaultRange; |
| ocomeni | 75:08eff6258e1b | 47 | |
| ocomeni | 75:08eff6258e1b | 48 | /** |
| ocomeni | 75:08eff6258e1b | 49 | * DefaultRange specialization for uint8_t. |
| ocomeni | 75:08eff6258e1b | 50 | */ |
| ocomeni | 75:08eff6258e1b | 51 | template<> |
| ocomeni | 75:08eff6258e1b | 52 | struct DefaultRange<uint8_t> { |
| ocomeni | 75:08eff6258e1b | 53 | typedef Range<0, 0xFF> type; |
| ocomeni | 75:08eff6258e1b | 54 | }; |
| ocomeni | 75:08eff6258e1b | 55 | |
| ocomeni | 75:08eff6258e1b | 56 | /** |
| ocomeni | 75:08eff6258e1b | 57 | * DefaultRange specialization for uint16_t. |
| ocomeni | 75:08eff6258e1b | 58 | */ |
| ocomeni | 75:08eff6258e1b | 59 | template<> |
| ocomeni | 75:08eff6258e1b | 60 | struct DefaultRange<uint16_t > { |
| ocomeni | 75:08eff6258e1b | 61 | typedef Range<0, 0xFFFF> type; |
| ocomeni | 75:08eff6258e1b | 62 | }; |
| ocomeni | 75:08eff6258e1b | 63 | |
| ocomeni | 75:08eff6258e1b | 64 | /** |
| ocomeni | 75:08eff6258e1b | 65 | * DefaultRange specialization for uint32_t |
| ocomeni | 75:08eff6258e1b | 66 | */ |
| ocomeni | 75:08eff6258e1b | 67 | template<> |
| ocomeni | 75:08eff6258e1b | 68 | struct DefaultRange<uint32_t> { |
| ocomeni | 75:08eff6258e1b | 69 | typedef Range<0, 0xFFFFFFFF> type; |
| ocomeni | 75:08eff6258e1b | 70 | }; |
| ocomeni | 75:08eff6258e1b | 71 | |
| ocomeni | 75:08eff6258e1b | 72 | /** |
| ocomeni | 75:08eff6258e1b | 73 | * Represent an integral compile time value that can be used in Duration. |
| ocomeni | 75:08eff6258e1b | 74 | * |
| ocomeni | 75:08eff6258e1b | 75 | * @tparam T Type of the integral value. |
| ocomeni | 75:08eff6258e1b | 76 | * @tparam V The integer value representing a never ending duration. |
| ocomeni | 75:08eff6258e1b | 77 | */ |
| ocomeni | 75:08eff6258e1b | 78 | template<typename T, T V> |
| ocomeni | 75:08eff6258e1b | 79 | struct Value { |
| ocomeni | 75:08eff6258e1b | 80 | static const T VALUE = V; |
| ocomeni | 75:08eff6258e1b | 81 | }; |
| ocomeni | 75:08eff6258e1b | 82 | |
| ocomeni | 75:08eff6258e1b | 83 | #endif |
| ocomeni | 75:08eff6258e1b | 84 | |
| ocomeni | 75:08eff6258e1b | 85 | /** |
| ocomeni | 75:08eff6258e1b | 86 | * Model BLE durations. |
| ocomeni | 75:08eff6258e1b | 87 | * |
| ocomeni | 75:08eff6258e1b | 88 | * @tparam Rep The representation type of the duration. |
| ocomeni | 75:08eff6258e1b | 89 | * @tparam TB The time base in micro seconds. |
| ocomeni | 75:08eff6258e1b | 90 | * @tparam Range Closed interval of the duration |
| ocomeni | 75:08eff6258e1b | 91 | * @tparam Forever The special value (if applicable) that represents a forever |
| ocomeni | 75:08eff6258e1b | 92 | * duration. |
| ocomeni | 75:08eff6258e1b | 93 | */ |
| ocomeni | 75:08eff6258e1b | 94 | template< |
| ocomeni | 75:08eff6258e1b | 95 | typename Rep, |
| ocomeni | 75:08eff6258e1b | 96 | uint32_t TB, |
| ocomeni | 75:08eff6258e1b | 97 | typename Range = typename DefaultRange<Rep>::type, |
| ocomeni | 75:08eff6258e1b | 98 | typename Forever = void* |
| ocomeni | 75:08eff6258e1b | 99 | > |
| ocomeni | 75:08eff6258e1b | 100 | struct Duration { |
| ocomeni | 75:08eff6258e1b | 101 | /** |
| ocomeni | 75:08eff6258e1b | 102 | * Type of the actual representation. |
| ocomeni | 75:08eff6258e1b | 103 | */ |
| ocomeni | 75:08eff6258e1b | 104 | typedef Rep representation_t; |
| ocomeni | 75:08eff6258e1b | 105 | |
| ocomeni | 75:08eff6258e1b | 106 | /** |
| ocomeni | 75:08eff6258e1b | 107 | * Construct a default Duration. |
| ocomeni | 75:08eff6258e1b | 108 | * |
| ocomeni | 75:08eff6258e1b | 109 | * It is initialized with the minimum value acceptable. |
| ocomeni | 75:08eff6258e1b | 110 | */ |
| ocomeni | 75:08eff6258e1b | 111 | Duration() : duration(Range::MIN) |
| ocomeni | 75:08eff6258e1b | 112 | { |
| ocomeni | 75:08eff6258e1b | 113 | } |
| ocomeni | 75:08eff6258e1b | 114 | |
| ocomeni | 75:08eff6258e1b | 115 | /** |
| ocomeni | 75:08eff6258e1b | 116 | * Construct a Duration from an integer value. |
| ocomeni | 75:08eff6258e1b | 117 | * |
| ocomeni | 75:08eff6258e1b | 118 | * @param v The value of the duration in TIME_BASE units. |
| ocomeni | 75:08eff6258e1b | 119 | */ |
| ocomeni | 75:08eff6258e1b | 120 | explicit Duration(Rep v) : duration(clamp(v)) |
| ocomeni | 75:08eff6258e1b | 121 | { |
| ocomeni | 75:08eff6258e1b | 122 | } |
| ocomeni | 75:08eff6258e1b | 123 | |
| ocomeni | 75:08eff6258e1b | 124 | /** |
| ocomeni | 75:08eff6258e1b | 125 | * Construct a Duration from another Duration. |
| ocomeni | 75:08eff6258e1b | 126 | * |
| ocomeni | 75:08eff6258e1b | 127 | * @note The operation fail at compile time if there is a loss of precision. |
| ocomeni | 75:08eff6258e1b | 128 | * |
| ocomeni | 75:08eff6258e1b | 129 | * @tparam OtherRep The type used to represent the other Duration. |
| ocomeni | 75:08eff6258e1b | 130 | * @tparam OtherTB The time base in micro seconds of the other Duration. |
| ocomeni | 75:08eff6258e1b | 131 | * @tparam OtherRange The range of the other Duration. |
| ocomeni | 75:08eff6258e1b | 132 | * @tparam OtherF The forever value of the other type. |
| ocomeni | 75:08eff6258e1b | 133 | * |
| ocomeni | 75:08eff6258e1b | 134 | * @param other The Duration used to construct this object. |
| ocomeni | 75:08eff6258e1b | 135 | */ |
| ocomeni | 75:08eff6258e1b | 136 | template<typename OtherRep, uint32_t OtherTB, typename OtherRange, typename OtherF> |
| ocomeni | 75:08eff6258e1b | 137 | Duration(Duration<OtherRep, OtherTB, OtherRange, OtherF> other) : |
| ocomeni | 75:08eff6258e1b | 138 | duration(clamp(other.value() * (OtherTB / TB))) |
| ocomeni | 75:08eff6258e1b | 139 | { |
| ocomeni | 75:08eff6258e1b | 140 | MBED_STATIC_ASSERT(OtherTB >= TB && (OtherTB % TB) == 0, "Incompatible units"); |
| ocomeni | 75:08eff6258e1b | 141 | } |
| ocomeni | 75:08eff6258e1b | 142 | |
| ocomeni | 75:08eff6258e1b | 143 | /** |
| ocomeni | 75:08eff6258e1b | 144 | * Construct a new Duration from a Duration in milliseconds. |
| ocomeni | 75:08eff6258e1b | 145 | * |
| ocomeni | 75:08eff6258e1b | 146 | * @note The result of the conversion is rounded up. |
| ocomeni | 75:08eff6258e1b | 147 | * |
| ocomeni | 75:08eff6258e1b | 148 | * @tparam OtherRep The representation type used by other_ms. |
| ocomeni | 75:08eff6258e1b | 149 | * @tparam OtherRange The range used by other_ms. |
| ocomeni | 75:08eff6258e1b | 150 | * @tparam OtherF The forever value used by other_ms. |
| ocomeni | 75:08eff6258e1b | 151 | * |
| ocomeni | 75:08eff6258e1b | 152 | * @param other_ms The Duration in millisecond to convert. |
| ocomeni | 75:08eff6258e1b | 153 | */ |
| ocomeni | 75:08eff6258e1b | 154 | template<typename OtherRep, typename OtherRange, typename OtherF> |
| ocomeni | 75:08eff6258e1b | 155 | explicit Duration(Duration<OtherRep, 1000, OtherRange, OtherF> other_ms, void* = NULL) : |
| ocomeni | 75:08eff6258e1b | 156 | duration(clamp(((other_ms.value() * 1000) + TB - 1) / TB)) |
| ocomeni | 75:08eff6258e1b | 157 | { |
| ocomeni | 75:08eff6258e1b | 158 | } |
| ocomeni | 75:08eff6258e1b | 159 | |
| ocomeni | 75:08eff6258e1b | 160 | /** |
| ocomeni | 75:08eff6258e1b | 161 | * Return the duration in TB units. |
| ocomeni | 75:08eff6258e1b | 162 | * |
| ocomeni | 75:08eff6258e1b | 163 | * @return The duration in TB units. |
| ocomeni | 75:08eff6258e1b | 164 | */ |
| ocomeni | 75:08eff6258e1b | 165 | Rep value() const |
| ocomeni | 75:08eff6258e1b | 166 | { |
| ocomeni | 75:08eff6258e1b | 167 | return duration; |
| ocomeni | 75:08eff6258e1b | 168 | } |
| ocomeni | 75:08eff6258e1b | 169 | |
| ocomeni | 75:08eff6258e1b | 170 | /** |
| ocomeni | 75:08eff6258e1b | 171 | * Return the duration in milliseconds. |
| ocomeni | 75:08eff6258e1b | 172 | * |
| ocomeni | 75:08eff6258e1b | 173 | * @return The duration in milliseconds. |
| ocomeni | 75:08eff6258e1b | 174 | */ |
| ocomeni | 75:08eff6258e1b | 175 | uint32_t valueInMs() const |
| ocomeni | 75:08eff6258e1b | 176 | { |
| ocomeni | 75:08eff6258e1b | 177 | return ((uint32_t)duration * TB) / 1000; |
| ocomeni | 75:08eff6258e1b | 178 | } |
| ocomeni | 75:08eff6258e1b | 179 | |
| ocomeni | 75:08eff6258e1b | 180 | /** |
| ocomeni | 75:08eff6258e1b | 181 | * The time base. |
| ocomeni | 75:08eff6258e1b | 182 | */ |
| ocomeni | 75:08eff6258e1b | 183 | static const uint32_t TIME_BASE = TB; |
| ocomeni | 75:08eff6258e1b | 184 | |
| ocomeni | 75:08eff6258e1b | 185 | /** |
| ocomeni | 75:08eff6258e1b | 186 | * Left-bound of the duration range. |
| ocomeni | 75:08eff6258e1b | 187 | */ |
| ocomeni | 75:08eff6258e1b | 188 | static const Rep MIN = Range::MIN; |
| ocomeni | 75:08eff6258e1b | 189 | |
| ocomeni | 75:08eff6258e1b | 190 | /** |
| ocomeni | 75:08eff6258e1b | 191 | * Right bound of the duration range. |
| ocomeni | 75:08eff6258e1b | 192 | */ |
| ocomeni | 75:08eff6258e1b | 193 | static const Rep MAX = Range::MAX; |
| ocomeni | 75:08eff6258e1b | 194 | |
| ocomeni | 75:08eff6258e1b | 195 | /** |
| ocomeni | 75:08eff6258e1b | 196 | * Return the minimum duration. |
| ocomeni | 75:08eff6258e1b | 197 | * |
| ocomeni | 75:08eff6258e1b | 198 | * @return The minimum duration. |
| ocomeni | 75:08eff6258e1b | 199 | */ |
| ocomeni | 75:08eff6258e1b | 200 | static Duration min() |
| ocomeni | 75:08eff6258e1b | 201 | { |
| ocomeni | 75:08eff6258e1b | 202 | return Duration(MIN); |
| ocomeni | 75:08eff6258e1b | 203 | } |
| ocomeni | 75:08eff6258e1b | 204 | |
| ocomeni | 75:08eff6258e1b | 205 | /** |
| ocomeni | 75:08eff6258e1b | 206 | * Return the maximum duration. |
| ocomeni | 75:08eff6258e1b | 207 | * |
| ocomeni | 75:08eff6258e1b | 208 | * @return The maximum duration. |
| ocomeni | 75:08eff6258e1b | 209 | */ |
| ocomeni | 75:08eff6258e1b | 210 | static Duration max() |
| ocomeni | 75:08eff6258e1b | 211 | { |
| ocomeni | 75:08eff6258e1b | 212 | return Duration(MAX); |
| ocomeni | 75:08eff6258e1b | 213 | } |
| ocomeni | 75:08eff6258e1b | 214 | |
| ocomeni | 75:08eff6258e1b | 215 | /** |
| ocomeni | 75:08eff6258e1b | 216 | * Return a pointer to the value of the duration. |
| ocomeni | 75:08eff6258e1b | 217 | * |
| ocomeni | 75:08eff6258e1b | 218 | * @return a pointer to the value of the duration. |
| ocomeni | 75:08eff6258e1b | 219 | */ |
| ocomeni | 75:08eff6258e1b | 220 | const Rep* storage() const |
| ocomeni | 75:08eff6258e1b | 221 | { |
| ocomeni | 75:08eff6258e1b | 222 | return &duration; |
| ocomeni | 75:08eff6258e1b | 223 | } |
| ocomeni | 75:08eff6258e1b | 224 | |
| ocomeni | 75:08eff6258e1b | 225 | /** |
| ocomeni | 75:08eff6258e1b | 226 | * Return the Duration value meaning forever. |
| ocomeni | 75:08eff6258e1b | 227 | * @return the Duration value meaning forever. |
| ocomeni | 75:08eff6258e1b | 228 | */ |
| ocomeni | 75:08eff6258e1b | 229 | static Duration forever() |
| ocomeni | 75:08eff6258e1b | 230 | { |
| ocomeni | 75:08eff6258e1b | 231 | return Duration(Forever::VALUE); |
| ocomeni | 75:08eff6258e1b | 232 | } |
| ocomeni | 75:08eff6258e1b | 233 | |
| ocomeni | 75:08eff6258e1b | 234 | private: |
| ocomeni | 75:08eff6258e1b | 235 | static Rep clamp(Rep in) |
| ocomeni | 75:08eff6258e1b | 236 | { |
| ocomeni | 75:08eff6258e1b | 237 | if (in < MIN) { |
| ocomeni | 75:08eff6258e1b | 238 | return MIN; |
| ocomeni | 75:08eff6258e1b | 239 | } else if (in > MAX) { |
| ocomeni | 75:08eff6258e1b | 240 | return MAX; |
| ocomeni | 75:08eff6258e1b | 241 | } else { |
| ocomeni | 75:08eff6258e1b | 242 | return in; |
| ocomeni | 75:08eff6258e1b | 243 | } |
| ocomeni | 75:08eff6258e1b | 244 | } |
| ocomeni | 75:08eff6258e1b | 245 | |
| ocomeni | 75:08eff6258e1b | 246 | Rep duration; |
| ocomeni | 75:08eff6258e1b | 247 | }; |
| ocomeni | 75:08eff6258e1b | 248 | |
| ocomeni | 75:08eff6258e1b | 249 | /** |
| ocomeni | 75:08eff6258e1b | 250 | * Type that represents micro seconds. |
| ocomeni | 75:08eff6258e1b | 251 | */ |
| ocomeni | 75:08eff6258e1b | 252 | typedef Duration<uint32_t, 1> microsecond_t; |
| ocomeni | 75:08eff6258e1b | 253 | |
| ocomeni | 75:08eff6258e1b | 254 | /** |
| ocomeni | 75:08eff6258e1b | 255 | * Type that represents milliseconds. |
| ocomeni | 75:08eff6258e1b | 256 | */ |
| ocomeni | 75:08eff6258e1b | 257 | typedef Duration<uint32_t, 1000 * microsecond_t::TIME_BASE> millisecond_t; |
| ocomeni | 75:08eff6258e1b | 258 | |
| ocomeni | 75:08eff6258e1b | 259 | /** |
| ocomeni | 75:08eff6258e1b | 260 | * Type that represents seconds. |
| ocomeni | 75:08eff6258e1b | 261 | */ |
| ocomeni | 75:08eff6258e1b | 262 | typedef Duration<uint32_t, 1000 * millisecond_t::TIME_BASE> second_t; |
| ocomeni | 75:08eff6258e1b | 263 | |
| ocomeni | 75:08eff6258e1b | 264 | /** |
| ocomeni | 75:08eff6258e1b | 265 | * Cast a duration to another. |
| ocomeni | 75:08eff6258e1b | 266 | * |
| ocomeni | 75:08eff6258e1b | 267 | * @tparam DurationOut Type of the Duration in output. |
| ocomeni | 75:08eff6258e1b | 268 | * @tparam RepIn The representation type of duration. |
| ocomeni | 75:08eff6258e1b | 269 | * @tparam TBIn The timebase of duration. |
| ocomeni | 75:08eff6258e1b | 270 | * @tparam RangeIn The range of duration. |
| ocomeni | 75:08eff6258e1b | 271 | * @tparam FIn The Forever value of duration. |
| ocomeni | 75:08eff6258e1b | 272 | * @param duration The duration to convert. |
| ocomeni | 75:08eff6258e1b | 273 | * @return The converted duration. It is rounded up if precision is lost. |
| ocomeni | 75:08eff6258e1b | 274 | * |
| ocomeni | 75:08eff6258e1b | 275 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 276 | */ |
| ocomeni | 75:08eff6258e1b | 277 | template<typename DurationOut, typename RepIn, uint32_t TBIn, typename RangeIn, typename FIn> |
| ocomeni | 75:08eff6258e1b | 278 | DurationOut durationCast(Duration<RepIn, TBIn, RangeIn, FIn> duration) |
| ocomeni | 75:08eff6258e1b | 279 | { |
| ocomeni | 75:08eff6258e1b | 280 | return DurationOut(((duration.value() * TBIn) + DurationOut::TIME_BASE - 1) / DurationOut::TIME_BASE); |
| ocomeni | 75:08eff6258e1b | 281 | } |
| ocomeni | 75:08eff6258e1b | 282 | |
| ocomeni | 75:08eff6258e1b | 283 | /** |
| ocomeni | 75:08eff6258e1b | 284 | * Add two durations together and return the result in microseconds. |
| ocomeni | 75:08eff6258e1b | 285 | * @param lhs Left hand side operand. |
| ocomeni | 75:08eff6258e1b | 286 | * @param rhs Right hand side operand. |
| ocomeni | 75:08eff6258e1b | 287 | * @return The result of the addition of the two durations in microseconds. |
| ocomeni | 75:08eff6258e1b | 288 | * |
| ocomeni | 75:08eff6258e1b | 289 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 290 | */ |
| ocomeni | 75:08eff6258e1b | 291 | template< |
| ocomeni | 75:08eff6258e1b | 292 | typename RepLHS, uint32_t TBLHS, typename RangeLHS, typename FLHS, |
| ocomeni | 75:08eff6258e1b | 293 | typename RepRHS, uint32_t TBRHS, typename RangeRHS, typename FRHS> |
| ocomeni | 75:08eff6258e1b | 294 | microsecond_t operator+( |
| ocomeni | 75:08eff6258e1b | 295 | Duration<RepLHS, TBLHS, RangeLHS, FLHS> lhs, |
| ocomeni | 75:08eff6258e1b | 296 | Duration<RepRHS, TBRHS, RangeRHS, FRHS> rhs |
| ocomeni | 75:08eff6258e1b | 297 | ) |
| ocomeni | 75:08eff6258e1b | 298 | { |
| ocomeni | 75:08eff6258e1b | 299 | return microsecond_t((lhs.value() * lhs.TIME_BASE) + (rhs.value() * rhs.TIME_BASE)); |
| ocomeni | 75:08eff6258e1b | 300 | } |
| ocomeni | 75:08eff6258e1b | 301 | |
| ocomeni | 75:08eff6258e1b | 302 | /** |
| ocomeni | 75:08eff6258e1b | 303 | * Add two durations together. |
| ocomeni | 75:08eff6258e1b | 304 | * @param lhs Left hand side operand. |
| ocomeni | 75:08eff6258e1b | 305 | * @param rhs Right hand side operand. |
| ocomeni | 75:08eff6258e1b | 306 | * @return The addition of the two durations in input. |
| ocomeni | 75:08eff6258e1b | 307 | * |
| ocomeni | 75:08eff6258e1b | 308 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 309 | */ |
| ocomeni | 75:08eff6258e1b | 310 | template<typename Rep, uint32_t TB, typename Range, typename F> |
| ocomeni | 75:08eff6258e1b | 311 | Duration<Rep, TB, Range, F> operator+( |
| ocomeni | 75:08eff6258e1b | 312 | Duration<Rep, TB, Range, F> lhs, |
| ocomeni | 75:08eff6258e1b | 313 | Duration<Rep, TB, Range, F> rhs |
| ocomeni | 75:08eff6258e1b | 314 | ) |
| ocomeni | 75:08eff6258e1b | 315 | { |
| ocomeni | 75:08eff6258e1b | 316 | return Duration<Rep, TB, Range, F>(lhs.value() + rhs.value()); |
| ocomeni | 75:08eff6258e1b | 317 | } |
| ocomeni | 75:08eff6258e1b | 318 | |
| ocomeni | 75:08eff6258e1b | 319 | /** |
| ocomeni | 75:08eff6258e1b | 320 | * Multiply a duration and a positive integer. |
| ocomeni | 75:08eff6258e1b | 321 | * |
| ocomeni | 75:08eff6258e1b | 322 | * @param lhs The duration. |
| ocomeni | 75:08eff6258e1b | 323 | * @param rhs The integer. |
| ocomeni | 75:08eff6258e1b | 324 | * |
| ocomeni | 75:08eff6258e1b | 325 | * @return A duration that represents the multiplication of lhs with rhs. |
| ocomeni | 75:08eff6258e1b | 326 | * |
| ocomeni | 75:08eff6258e1b | 327 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 328 | */ |
| ocomeni | 75:08eff6258e1b | 329 | template<typename Rep, uint32_t TB, typename Range, typename F> |
| ocomeni | 75:08eff6258e1b | 330 | Duration<Rep, TB, Range, F> operator*(Duration<Rep, TB, Range, F> lhs, uint32_t rhs) |
| ocomeni | 75:08eff6258e1b | 331 | { |
| ocomeni | 75:08eff6258e1b | 332 | return Duration<Rep, TB, Range, F>(lhs.value() * rhs); |
| ocomeni | 75:08eff6258e1b | 333 | } |
| ocomeni | 75:08eff6258e1b | 334 | |
| ocomeni | 75:08eff6258e1b | 335 | /** |
| ocomeni | 75:08eff6258e1b | 336 | * Multiply a duration and a positive integer. |
| ocomeni | 75:08eff6258e1b | 337 | * |
| ocomeni | 75:08eff6258e1b | 338 | * @param lhs The integer. |
| ocomeni | 75:08eff6258e1b | 339 | * @param rhs The multiplication. |
| ocomeni | 75:08eff6258e1b | 340 | * |
| ocomeni | 75:08eff6258e1b | 341 | * @return A duration that represents the multiplication of lhs with rhs. |
| ocomeni | 75:08eff6258e1b | 342 | * |
| ocomeni | 75:08eff6258e1b | 343 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 344 | */ |
| ocomeni | 75:08eff6258e1b | 345 | template<typename Rep, uint32_t TB, typename Range, typename F> |
| ocomeni | 75:08eff6258e1b | 346 | Duration<Rep, TB, Range, F> operator*(uint32_t lhs, Duration<Rep, TB, Range, F> rhs) |
| ocomeni | 75:08eff6258e1b | 347 | { |
| ocomeni | 75:08eff6258e1b | 348 | return Duration<Rep, TB, Range, F>(lhs * rhs.value()); |
| ocomeni | 75:08eff6258e1b | 349 | } |
| ocomeni | 75:08eff6258e1b | 350 | |
| ocomeni | 75:08eff6258e1b | 351 | /** |
| ocomeni | 75:08eff6258e1b | 352 | * Indicate if the duration lhs is less than the duration rhs. |
| ocomeni | 75:08eff6258e1b | 353 | * @param lhs Left hand side operand. |
| ocomeni | 75:08eff6258e1b | 354 | * @param rhs Right hand side operand. |
| ocomeni | 75:08eff6258e1b | 355 | * @return true if lhs is less than rhs and false otherwise. |
| ocomeni | 75:08eff6258e1b | 356 | * |
| ocomeni | 75:08eff6258e1b | 357 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 358 | */ |
| ocomeni | 75:08eff6258e1b | 359 | template< |
| ocomeni | 75:08eff6258e1b | 360 | typename RepLHS, uint32_t TBLHS, typename RangeLHS, typename FLHS, |
| ocomeni | 75:08eff6258e1b | 361 | typename RepRHS, uint32_t TBRHS, typename RangeRHS, typename FRHS |
| ocomeni | 75:08eff6258e1b | 362 | > |
| ocomeni | 75:08eff6258e1b | 363 | bool operator<(Duration<RepLHS, TBLHS, RangeLHS, FLHS> lhs, Duration<RepRHS, TBRHS, RangeRHS, FRHS> rhs) |
| ocomeni | 75:08eff6258e1b | 364 | { |
| ocomeni | 75:08eff6258e1b | 365 | return lhs.value() * lhs.TIME_BASE < rhs.value() * rhs.TIME_BASE; |
| ocomeni | 75:08eff6258e1b | 366 | } |
| ocomeni | 75:08eff6258e1b | 367 | |
| ocomeni | 75:08eff6258e1b | 368 | /** |
| ocomeni | 75:08eff6258e1b | 369 | * Indicate if the duration lhs is less than the duration rhs. |
| ocomeni | 75:08eff6258e1b | 370 | * @param lhs Left hand side operand. |
| ocomeni | 75:08eff6258e1b | 371 | * @param rhs Right hand side operand. |
| ocomeni | 75:08eff6258e1b | 372 | * @return true if lhs is less than rhs and false otherwise. |
| ocomeni | 75:08eff6258e1b | 373 | * |
| ocomeni | 75:08eff6258e1b | 374 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 375 | */ |
| ocomeni | 75:08eff6258e1b | 376 | template<typename Rep, uint32_t Us, typename Range, typename F> |
| ocomeni | 75:08eff6258e1b | 377 | bool operator<(Duration<Rep, Us, Range, F> lhs, Duration<Rep, Us, Range, F> rhs) |
| ocomeni | 75:08eff6258e1b | 378 | { |
| ocomeni | 75:08eff6258e1b | 379 | return lhs.value() < rhs.value(); |
| ocomeni | 75:08eff6258e1b | 380 | } |
| ocomeni | 75:08eff6258e1b | 381 | |
| ocomeni | 75:08eff6258e1b | 382 | /** |
| ocomeni | 75:08eff6258e1b | 383 | * Indicate if the duration lhs is less than or equal to the duration rhs. |
| ocomeni | 75:08eff6258e1b | 384 | * @param lhs Left hand side operand. |
| ocomeni | 75:08eff6258e1b | 385 | * @param rhs Right hand side operand. |
| ocomeni | 75:08eff6258e1b | 386 | * @return true if lhs is less than or equal to rhs and false otherwise. |
| ocomeni | 75:08eff6258e1b | 387 | * |
| ocomeni | 75:08eff6258e1b | 388 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 389 | */ |
| ocomeni | 75:08eff6258e1b | 390 | template< |
| ocomeni | 75:08eff6258e1b | 391 | typename RepLHS, uint32_t TBLHS, typename RangeLHS, typename FLHS, |
| ocomeni | 75:08eff6258e1b | 392 | typename RepRHS, uint32_t TBRHS, typename RangeRHS, typename FRHS |
| ocomeni | 75:08eff6258e1b | 393 | > |
| ocomeni | 75:08eff6258e1b | 394 | bool operator<=( |
| ocomeni | 75:08eff6258e1b | 395 | Duration<RepLHS, TBLHS, RangeLHS, FLHS> lhs, |
| ocomeni | 75:08eff6258e1b | 396 | Duration<RepRHS, TBRHS, RangeRHS, FRHS> rhs |
| ocomeni | 75:08eff6258e1b | 397 | ) |
| ocomeni | 75:08eff6258e1b | 398 | { |
| ocomeni | 75:08eff6258e1b | 399 | return lhs.value() * lhs.TIME_BASE <= rhs.value() * rhs.TIME_BASE; |
| ocomeni | 75:08eff6258e1b | 400 | } |
| ocomeni | 75:08eff6258e1b | 401 | |
| ocomeni | 75:08eff6258e1b | 402 | /** |
| ocomeni | 75:08eff6258e1b | 403 | * Indicate if the duration lhs is less than or equal to the duration rhs. |
| ocomeni | 75:08eff6258e1b | 404 | * @param lhs Left hand side operand. |
| ocomeni | 75:08eff6258e1b | 405 | * @param rhs Right hand side operand. |
| ocomeni | 75:08eff6258e1b | 406 | * @return true if lhs is less than or equal to rhs and false otherwise. |
| ocomeni | 75:08eff6258e1b | 407 | * |
| ocomeni | 75:08eff6258e1b | 408 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 409 | */ |
| ocomeni | 75:08eff6258e1b | 410 | template<typename Rep, uint32_t Us, typename Range> |
| ocomeni | 75:08eff6258e1b | 411 | bool operator<=(Duration<Rep, Us, Range> lhs, Duration<Rep, Us, Range> rhs) |
| ocomeni | 75:08eff6258e1b | 412 | { |
| ocomeni | 75:08eff6258e1b | 413 | return lhs.value() <= rhs.value(); |
| ocomeni | 75:08eff6258e1b | 414 | } |
| ocomeni | 75:08eff6258e1b | 415 | |
| ocomeni | 75:08eff6258e1b | 416 | /** |
| ocomeni | 75:08eff6258e1b | 417 | * Indicate if the duration lhs is equal to the duration rhs. |
| ocomeni | 75:08eff6258e1b | 418 | * @param lhs Left hand side operand. |
| ocomeni | 75:08eff6258e1b | 419 | * @param rhs Right hand side operand. |
| ocomeni | 75:08eff6258e1b | 420 | * @return true if lhs is equal to rhs and false otherwise. |
| ocomeni | 75:08eff6258e1b | 421 | * |
| ocomeni | 75:08eff6258e1b | 422 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 423 | */ |
| ocomeni | 75:08eff6258e1b | 424 | template< |
| ocomeni | 75:08eff6258e1b | 425 | typename RepLHS, uint32_t TBLHS, typename RangeLHS, typename FLHS, |
| ocomeni | 75:08eff6258e1b | 426 | typename RepRHS, uint32_t TBRHS, typename RangeRHS, typename FRHS |
| ocomeni | 75:08eff6258e1b | 427 | > |
| ocomeni | 75:08eff6258e1b | 428 | bool operator==( |
| ocomeni | 75:08eff6258e1b | 429 | Duration<RepLHS, TBLHS, RangeLHS, FLHS> lhs, |
| ocomeni | 75:08eff6258e1b | 430 | Duration<RepRHS, TBRHS, RangeRHS, FRHS> rhs |
| ocomeni | 75:08eff6258e1b | 431 | ) |
| ocomeni | 75:08eff6258e1b | 432 | { |
| ocomeni | 75:08eff6258e1b | 433 | return lhs.value() * lhs.TIME_BASE == rhs.value() * rhs.TIME_BASE; |
| ocomeni | 75:08eff6258e1b | 434 | } |
| ocomeni | 75:08eff6258e1b | 435 | |
| ocomeni | 75:08eff6258e1b | 436 | /** |
| ocomeni | 75:08eff6258e1b | 437 | * Indicate if the duration lhs is equal to the duration rhs. |
| ocomeni | 75:08eff6258e1b | 438 | * @param lhs Left hand side operand. |
| ocomeni | 75:08eff6258e1b | 439 | * @param rhs Right hand side operand. |
| ocomeni | 75:08eff6258e1b | 440 | * @return true if lhs is equal to rhs and false otherwise. |
| ocomeni | 75:08eff6258e1b | 441 | * |
| ocomeni | 75:08eff6258e1b | 442 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 443 | */ |
| ocomeni | 75:08eff6258e1b | 444 | template<typename Rep, uint32_t Us, typename Range, typename F> |
| ocomeni | 75:08eff6258e1b | 445 | bool operator==(Duration<Rep, Us, Range, F> lhs, Duration<Rep, Us, Range, F> rhs) |
| ocomeni | 75:08eff6258e1b | 446 | { |
| ocomeni | 75:08eff6258e1b | 447 | return lhs.value() == rhs.value(); |
| ocomeni | 75:08eff6258e1b | 448 | } |
| ocomeni | 75:08eff6258e1b | 449 | |
| ocomeni | 75:08eff6258e1b | 450 | /** |
| ocomeni | 75:08eff6258e1b | 451 | * Indicate if the duration lhs is not equal to the duration rhs. |
| ocomeni | 75:08eff6258e1b | 452 | * @param lhs Left hand side operand. |
| ocomeni | 75:08eff6258e1b | 453 | * @param rhs Right hand side operand. |
| ocomeni | 75:08eff6258e1b | 454 | * @return true if lhs is not equal to rhs and false otherwise. |
| ocomeni | 75:08eff6258e1b | 455 | * |
| ocomeni | 75:08eff6258e1b | 456 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 457 | */ |
| ocomeni | 75:08eff6258e1b | 458 | template< |
| ocomeni | 75:08eff6258e1b | 459 | typename RepLHS, uint32_t TBLHS, typename RangeLHS, typename FLHS, |
| ocomeni | 75:08eff6258e1b | 460 | typename RepRHS, uint32_t TBRHS, typename RangeRHS, typename FRHS |
| ocomeni | 75:08eff6258e1b | 461 | > |
| ocomeni | 75:08eff6258e1b | 462 | bool operator!=( |
| ocomeni | 75:08eff6258e1b | 463 | Duration<RepLHS, TBLHS, RangeLHS, FLHS> lhs, |
| ocomeni | 75:08eff6258e1b | 464 | Duration<RepRHS, TBRHS, RangeRHS, FRHS> rhs |
| ocomeni | 75:08eff6258e1b | 465 | ) |
| ocomeni | 75:08eff6258e1b | 466 | { |
| ocomeni | 75:08eff6258e1b | 467 | return !(lhs == rhs); |
| ocomeni | 75:08eff6258e1b | 468 | } |
| ocomeni | 75:08eff6258e1b | 469 | |
| ocomeni | 75:08eff6258e1b | 470 | /** |
| ocomeni | 75:08eff6258e1b | 471 | * Indicate if the duration lhs is not equal to the duration rhs. |
| ocomeni | 75:08eff6258e1b | 472 | * @param lhs Left hand side operand. |
| ocomeni | 75:08eff6258e1b | 473 | * @param rhs Right hand side operand. |
| ocomeni | 75:08eff6258e1b | 474 | * @return true if lhs is not equal to rhs and false otherwise. |
| ocomeni | 75:08eff6258e1b | 475 | * |
| ocomeni | 75:08eff6258e1b | 476 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 477 | */ |
| ocomeni | 75:08eff6258e1b | 478 | template<typename Rep, uint32_t Us, typename Range, typename F> |
| ocomeni | 75:08eff6258e1b | 479 | bool operator!=(Duration<Rep, Us, Range, F> lhs, Duration<Rep, Us, Range, F> rhs) |
| ocomeni | 75:08eff6258e1b | 480 | { |
| ocomeni | 75:08eff6258e1b | 481 | return !(lhs == rhs); |
| ocomeni | 75:08eff6258e1b | 482 | } |
| ocomeni | 75:08eff6258e1b | 483 | |
| ocomeni | 75:08eff6258e1b | 484 | /** |
| ocomeni | 75:08eff6258e1b | 485 | * Indicate if the duration lhs greater or equal to the duration rhs. |
| ocomeni | 75:08eff6258e1b | 486 | * @param lhs Left hand side operand. |
| ocomeni | 75:08eff6258e1b | 487 | * @param rhs Right hand side operand. |
| ocomeni | 75:08eff6258e1b | 488 | * @return true if lhs is greater or equal to rhs and false otherwise. |
| ocomeni | 75:08eff6258e1b | 489 | * |
| ocomeni | 75:08eff6258e1b | 490 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 491 | */ |
| ocomeni | 75:08eff6258e1b | 492 | template< |
| ocomeni | 75:08eff6258e1b | 493 | typename RepLHS, uint32_t TBLHS, typename RangeLHS, typename FLHS, |
| ocomeni | 75:08eff6258e1b | 494 | typename RepRHS, uint32_t TBRHS, typename RangeRHS, typename FRHS |
| ocomeni | 75:08eff6258e1b | 495 | > |
| ocomeni | 75:08eff6258e1b | 496 | bool operator>=( |
| ocomeni | 75:08eff6258e1b | 497 | Duration<RepLHS, TBLHS, RangeLHS, FLHS> lhs, |
| ocomeni | 75:08eff6258e1b | 498 | Duration<RepRHS, TBRHS, RangeRHS, FRHS> rhs |
| ocomeni | 75:08eff6258e1b | 499 | ) |
| ocomeni | 75:08eff6258e1b | 500 | { |
| ocomeni | 75:08eff6258e1b | 501 | return rhs <= lhs; |
| ocomeni | 75:08eff6258e1b | 502 | } |
| ocomeni | 75:08eff6258e1b | 503 | |
| ocomeni | 75:08eff6258e1b | 504 | /** |
| ocomeni | 75:08eff6258e1b | 505 | * Indicate if the duration lhs greater or equal to the duration rhs. |
| ocomeni | 75:08eff6258e1b | 506 | * @param lhs Left hand side operand. |
| ocomeni | 75:08eff6258e1b | 507 | * @param rhs Right hand side operand. |
| ocomeni | 75:08eff6258e1b | 508 | * @return true if lhs is greater or equal to rhs and false otherwise. |
| ocomeni | 75:08eff6258e1b | 509 | * |
| ocomeni | 75:08eff6258e1b | 510 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 511 | */ |
| ocomeni | 75:08eff6258e1b | 512 | template<typename Rep, uint32_t Us, typename Range, typename F> |
| ocomeni | 75:08eff6258e1b | 513 | bool operator>=(Duration<Rep, Us, Range, F> lhs, Duration<Rep, Us, Range, F> rhs) |
| ocomeni | 75:08eff6258e1b | 514 | { |
| ocomeni | 75:08eff6258e1b | 515 | return rhs <= lhs; |
| ocomeni | 75:08eff6258e1b | 516 | } |
| ocomeni | 75:08eff6258e1b | 517 | |
| ocomeni | 75:08eff6258e1b | 518 | /** |
| ocomeni | 75:08eff6258e1b | 519 | * Indicate if the duration lhs greater than the duration rhs. |
| ocomeni | 75:08eff6258e1b | 520 | * @param lhs Left hand side operand. |
| ocomeni | 75:08eff6258e1b | 521 | * @param rhs Right hand side operand. |
| ocomeni | 75:08eff6258e1b | 522 | * @return true if lhs is greater than rhs and false otherwise. |
| ocomeni | 75:08eff6258e1b | 523 | * |
| ocomeni | 75:08eff6258e1b | 524 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 525 | */ |
| ocomeni | 75:08eff6258e1b | 526 | template< |
| ocomeni | 75:08eff6258e1b | 527 | typename RepLHS, uint32_t TBLHS, typename RangeLHS, typename FLHS, |
| ocomeni | 75:08eff6258e1b | 528 | typename RepRHS, uint32_t TBRHS, typename RangeRHS, typename FRHS |
| ocomeni | 75:08eff6258e1b | 529 | > |
| ocomeni | 75:08eff6258e1b | 530 | bool operator>( |
| ocomeni | 75:08eff6258e1b | 531 | Duration<RepLHS, TBLHS, RangeLHS, FLHS> lhs, |
| ocomeni | 75:08eff6258e1b | 532 | Duration<RepRHS, TBRHS, RangeRHS, FRHS> rhs |
| ocomeni | 75:08eff6258e1b | 533 | ) |
| ocomeni | 75:08eff6258e1b | 534 | { |
| ocomeni | 75:08eff6258e1b | 535 | return rhs < lhs; |
| ocomeni | 75:08eff6258e1b | 536 | } |
| ocomeni | 75:08eff6258e1b | 537 | |
| ocomeni | 75:08eff6258e1b | 538 | /** |
| ocomeni | 75:08eff6258e1b | 539 | * Indicate if the duration lhs greater than the duration rhs. |
| ocomeni | 75:08eff6258e1b | 540 | * @param lhs Left hand side operand. |
| ocomeni | 75:08eff6258e1b | 541 | * @param rhs Right hand side operand. |
| ocomeni | 75:08eff6258e1b | 542 | * @return true if lhs is greater than rhs and false otherwise. |
| ocomeni | 75:08eff6258e1b | 543 | * |
| ocomeni | 75:08eff6258e1b | 544 | * @related Duration |
| ocomeni | 75:08eff6258e1b | 545 | */ |
| ocomeni | 75:08eff6258e1b | 546 | template<typename Rep, uint32_t Us, typename Range, typename F> |
| ocomeni | 75:08eff6258e1b | 547 | bool operator>(Duration<Rep, Us, Range, F> lhs, Duration<Rep, Us, Range, F> rhs) |
| ocomeni | 75:08eff6258e1b | 548 | { |
| ocomeni | 75:08eff6258e1b | 549 | return rhs < lhs; |
| ocomeni | 75:08eff6258e1b | 550 | } |
| ocomeni | 75:08eff6258e1b | 551 | |
| ocomeni | 75:08eff6258e1b | 552 | /* ---------------------- Static variable initialization -------------------- */ |
| ocomeni | 75:08eff6258e1b | 553 | |
| ocomeni | 75:08eff6258e1b | 554 | #if !defined(DOXYGEN_ONLY) |
| ocomeni | 75:08eff6258e1b | 555 | |
| ocomeni | 75:08eff6258e1b | 556 | template<uint32_t Min, uint32_t Max> |
| ocomeni | 75:08eff6258e1b | 557 | const uint32_t Range<Min, Max>::MIN; |
| ocomeni | 75:08eff6258e1b | 558 | |
| ocomeni | 75:08eff6258e1b | 559 | template<uint32_t Min, uint32_t Max> |
| ocomeni | 75:08eff6258e1b | 560 | const uint32_t Range<Min, Max>::MAX; |
| ocomeni | 75:08eff6258e1b | 561 | |
| ocomeni | 75:08eff6258e1b | 562 | template<typename T, T V> |
| ocomeni | 75:08eff6258e1b | 563 | const T Value<T, V>::VALUE; |
| ocomeni | 75:08eff6258e1b | 564 | |
| ocomeni | 75:08eff6258e1b | 565 | #endif |
| ocomeni | 75:08eff6258e1b | 566 | |
| ocomeni | 75:08eff6258e1b | 567 | template<typename Rep, uint32_t TB, typename Range, typename Forever> |
| ocomeni | 75:08eff6258e1b | 568 | const uint32_t Duration<Rep, TB, Range, Forever>::TIME_BASE; |
| ocomeni | 75:08eff6258e1b | 569 | |
| ocomeni | 75:08eff6258e1b | 570 | template<typename Rep, uint32_t TB, typename Range, typename Forever> |
| ocomeni | 75:08eff6258e1b | 571 | const Rep Duration<Rep, TB, Range, Forever>::MIN; |
| ocomeni | 75:08eff6258e1b | 572 | |
| ocomeni | 75:08eff6258e1b | 573 | template<typename Rep, uint32_t TB, typename Range, typename Forever> |
| ocomeni | 75:08eff6258e1b | 574 | const Rep Duration<Rep, TB, Range, Forever>::MAX; |
| ocomeni | 75:08eff6258e1b | 575 | |
| ocomeni | 75:08eff6258e1b | 576 | } |
| ocomeni | 75:08eff6258e1b | 577 | |
| ocomeni | 75:08eff6258e1b | 578 | #endif //BLE_COMMON_DURATION_H_ |