7 #ifndef ZPP_INCLUDE_ZPP_FMT_HPP 
    8 #define ZPP_INCLUDE_ZPP_FMT_HPP 
   10 #include <zephyr/kernel.h> 
   11 #include <zephyr/sys/__assert.h> 
   22 inline void print_arg(
bool v) noexcept { printk(
"%d", (
int)v); }
 
   23 inline void print_arg(
float v) noexcept { printk(
"%f", v); }
 
   24 inline void print_arg(
double v) noexcept { printk(
"%g", v); }
 
   25 inline void print_arg(
char v) noexcept { printk(
"%c", v); }
 
   26 inline void print_arg(
const char* v) noexcept { printk(
"%s", v); }
 
   27 inline void print_arg(
const void* v) noexcept { printk(
"%p", v); }
 
   28 inline void print_arg(uint8_t v) noexcept { printk(
"%d", (uint32_t)v); }
 
   29 inline void print_arg(int8_t v) noexcept { printk(
"%d", (int32_t)v); }
 
   30 inline void print_arg(uint16_t v) noexcept { printk(
"%d", (uint32_t)v); }
 
   31 inline void print_arg(int16_t v) noexcept { printk(
"%d", (int32_t)v); }
 
   32 inline void print_arg(uint32_t v) noexcept { printk(
"%d", v); }
 
   33 inline void print_arg(int32_t v) noexcept { printk(
"%d", v); }
 
   34 inline void print_arg(uint64_t v) noexcept { printk(
"%lld", v); }
 
   35 inline void print_arg(int64_t v) noexcept { printk(
"%lld", v); }
 
   37 template<
class T_Rep, 
class T_Period>
 
   38 inline void print_arg(std::chrono::duration<T_Rep, T_Period> v)
 
   40   using namespace std::chrono;
 
   42   auto s = duration_cast<seconds>(v);
 
   43   v -= duration_cast<decltype(v)>(s);
 
   44   auto ms = duration_cast<milliseconds>(v);
 
   45   v -= duration_cast<decltype(v)>(ms);
 
   46   auto us = duration_cast<microseconds>(v);
 
   47   v -= duration_cast<decltype(v)>(us);
 
   48   auto ns = duration_cast<nanoseconds>(v);
 
   50   printk(
"%d.%03d%03d%03ds",
 
   51     (
int)s.count(), (
int)ms.count(),
 
   52     (
int)us.count(), (
int)ns.count());
 
   55 template<
class T_Clock>
 
   56 inline void print_arg(std::chrono::time_point<T_Clock> v)
 
   66 template<
class T_FirstArg, 
class ...T_Args>
 
   67 inline void print_helper(
const char* fmt, T_FirstArg&& first, T_Args&&... args) noexcept
 
   69   enum class state { normal, format, open_brace, close_brace, done };
 
   71   state s = state::normal;
 
   85         s = state::open_brace;
 
   88         s = state::close_brace;
 
   96     case state::open_brace:
 
  113     case state::close_brace:
 
  135     if (s == state::done) {
 
  140   print_arg(std::forward<T_FirstArg>(first));
 
  156 template<
class ...T_Args>
 
  157 inline void print(
const char* fmt, T_Args&&... args) noexcept
 
void print_arg() noexcept
void print_helper(const char *fmt) noexcept
void print(const char *fmt, T_Args &&... args) noexcept
simple typesafe print function