/** \file * \brief This file implements utility functions used by the communications package. */ /** * \ingroup CONSOLE */ /* Include Files */ #include "KTag.h" /* Local Definitions and Constants */ /* Public Variables */ /* Private Variables */ static char8 uint64_buffer[20+1]; /* Private Function Prototypes */ /* Public Functions */ //! Converts a UInt64 to a NULL-terminated string. /*! * This function is necessary because newlib-nano does not support "%llu" / #PRIu64. * \see https://answers.launchpad.net/gcc-arm-embedded/+question/257014 * * \note This function is not reentrant! * * \param value pointer to the digital input object. * \return pointer to a NULL-terminated string containing the base-10 textual representation of #value. */ char8 * COMM_UInt64ToDecimal(uint64_t value) { char8 * p = uint64_buffer + sizeof(uint64_buffer); *(--p) = 0x00; for (bool first_time = true; value || first_time; first_time = false) { const uint32_t digit = value % 10; const char c = '0' + digit; *(--p) = c; value = value / 10; } return p; } /* Private Functions */