From d7ed2aeaa351b3d5f4e64ce2ad0c490eac1b6b22 Mon Sep 17 00:00:00 2001
From: graham sanderson <graham.sanderson@raspberrypi.com>
Date: Wed, 24 Feb 2021 17:37:59 -0600
Subject: [PATCH] re-arrange pico/types.h to avoid duplicate doxygen

---
 src/common/pico_base/include/pico.h        |  1 -
 src/common/pico_base/include/pico/assert.h |  2 +-
 src/common/pico_base/include/pico/types.h  | 38 +++++++++-------------
 3 files changed, 17 insertions(+), 24 deletions(-)

diff --git a/src/common/pico_base/include/pico.h b/src/common/pico_base/include/pico.h
index cdd5c237..c7537b11 100644
--- a/src/common/pico_base/include/pico.h
+++ b/src/common/pico_base/include/pico.h
@@ -17,7 +17,6 @@
 #include "pico/version.h"
 #include "pico/config.h"
 #include "pico/platform.h"
-#include "pico/assert.h"
 #include "pico/error.h"
 
 #endif
diff --git a/src/common/pico_base/include/pico/assert.h b/src/common/pico_base/include/pico/assert.h
index aa1a5465..8910ebdb 100644
--- a/src/common/pico_base/include/pico/assert.h
+++ b/src/common/pico_base/include/pico/assert.h
@@ -7,7 +7,7 @@
 #ifndef _PICO_ASSERT_H
 #define _PICO_ASSERT_H
 
-#include "pico/types.h"
+#include <stdbool.h>
 
 #ifdef __cplusplus
 
diff --git a/src/common/pico_base/include/pico/types.h b/src/common/pico_base/include/pico/types.h
index 6eab5179..914bfb86 100644
--- a/src/common/pico_base/include/pico/types.h
+++ b/src/common/pico_base/include/pico/types.h
@@ -7,13 +7,14 @@
 #ifndef _PICO_TYPES_H
 #define _PICO_TYPES_H
 
+#include "pico/assert.h"
+
 #include <stdint.h>
 #include <stdbool.h>
 #include <stddef.h>
 
 typedef unsigned int uint;
 
-#ifdef NDEBUG
 /*! \typedef absolute_time_t
     \brief An opaque 64 bit timestamp in microseconds
 
@@ -23,32 +24,13 @@ typedef unsigned int uint;
     \see to_us_since_boot
     \see update_us_since_boot
 */
+#ifndef NDEBUG
 typedef uint64_t absolute_time_t;
-
-/*! fn to_us_since_boot
- * \brief convert an absolute_time_t into a number of microseconds since boot.
- * \param t the absolute time to convert
- * \return a number of microseconds since boot, equivalent to t
- */
-static inline uint64_t to_us_since_boot(absolute_time_t t) {
-    return t;
-}
-
-/*! fn update_us_since_boot
- * \brief update an absolute_time_t value to represent a given number of microseconds since boot
- * \param t the absolute time value to update
- * \param us_since_boot the number of microseconds since boot to represent. Note this should be representable
- *                      as a signed 64 bit integer
- */
-static inline void update_us_since_boot(absolute_time_t *t, uint64_t us_since_boot) {
-    *t = us_since_boot;
-}
-
-#define ABSOLUTE_TIME_INITIALIZED_VAR(name, value) name = value
 #else
 typedef struct {
     uint64_t _private_us_since_boot;
 } absolute_time_t;
+#endif
 
 /*! fn to_us_since_boot
  * \brief convert an absolute_time_t into a number of microseconds since boot.
@@ -56,7 +38,11 @@ typedef struct {
  * \return a number of microseconds since boot, equivalent to t
  */
 static inline uint64_t to_us_since_boot(absolute_time_t t) {
+#ifndef NDEBUG
+    return t;
+#else
     return t._private_us_since_boot;
+#endif
 }
 
 /*! fn update_us_since_boot
@@ -66,9 +52,17 @@ static inline uint64_t to_us_since_boot(absolute_time_t t) {
  *                      as a signed 64 bit integer
  */
 static inline void update_us_since_boot(absolute_time_t *t, uint64_t us_since_boot) {
+#ifndef NDEBUG
+    *t = us_since_boot;
+#else
     assert(us_since_boot <= INT64_MAX);
     t->_private_us_since_boot = us_since_boot;
+#endif
 }
+
+#ifndef NDEBUG
+#define ABSOLUTE_TIME_INITIALIZED_VAR(name, value) name = value
+#else
 #define ABSOLUTE_TIME_INITIALIZED_VAR(name, value) name = {value}
 #endif