// (C) 2020-2026 Philip Endecott.
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENCE.txt or copy at https://www.boost.org/LICENSE_1_0.txt

#ifndef lipstick_debug_hh
#define lipstick_debug_hh

#include "power.hh"
#include "uart.hh"


// -DENABLE_DEBUG in the Makefile to turn this on.

#ifdef ENABLE_DEBUG
extern volatile Uart& debug_uart;
#endif

inline void setup_debug()
{
#ifdef ENABLE_DEBUG
  debug_uart.setup<38400,false>();
#endif
}

template <typename... T>
void debug(T&&... t [[maybe_unused]])
{
#ifdef ENABLE_DEBUG
  debug_uart.send(std::forward<T>(t)...);
#endif
}

constexpr auto debug_power_bits = 
#ifdef ENABLE_DEBUG
  PCUART0;
#else
  0;
#endif


#endif

