mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-26 17:55:28 +03:00
Added timeDelta_t type
This commit is contained in:
parent
30a893a1ca
commit
3c3047e677
3 changed files with 5 additions and 1 deletions
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "platform.h"
|
||||
|
||||
// time difference, 32 bits always sufficient
|
||||
typedef int32_t timeDelta_t;
|
||||
// millisecond time
|
||||
typedef uint32_t timeMs_t ;
|
||||
// microsecond time
|
||||
|
@ -31,3 +33,5 @@ typedef uint64_t timeUs_t;
|
|||
typedef uint32_t timeUs_t;
|
||||
#define TIMEUS_MAX UINT32_MAX
|
||||
#endif
|
||||
|
||||
static inline timeDelta_t cmpTimeUs(timeUs_t a, timeUs_t b) { return (timeDelta_t)(a - b); }
|
||||
|
|
|
@ -73,7 +73,6 @@ http://resnet.uoregon.edu/~gurney_j/jmpc/bitwise.html
|
|||
|
||||
static inline int16_t cmp16(uint16_t a, uint16_t b) { return a-b; }
|
||||
static inline int32_t cmp32(uint32_t a, uint32_t b) { return a-b; }
|
||||
static inline int32_t cmpTimeUs(timeUs_t a, timeUs_t b) { return a-b; }
|
||||
|
||||
// using memcpy_fn will force memcpy function call, instead of inlining it. In most cases function call takes fewer instructions
|
||||
// than inlined version (inlining is cheaper for very small moves < 8 bytes / 2 store instructions)
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
#include "build/debug.h"
|
||||
|
||||
#include "common/axis.h"
|
||||
#include "common/time.h"
|
||||
|
||||
#include "drivers/system.h"
|
||||
#include "drivers/serial.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue