#ifndef _AUDIOC_HPP
#define _AUDIOC_HPP

#include "daisy_seed.h"

#define AUDIOC_LOG	(daisy_hw.PrintLine)
extern daisy::DaisySeed daisy_hw;

#define AUDIOC_DEBUG

#ifdef AUDIOC_DEBUG

#define AUDIOC_DBG_IND()	(daisy_hw.SetLed(true))
#define AUDIOC_DBG_BRK()	__asm("BKPT 234")

#define AUDIOC_PRECOND(cond) \
	do { \
		if (! (cond)) { \
		AUDIOC_LOG("AC_PRECOND(" #cond ") @ %s: line %u failed\n", \
		    __FILE__, __LINE__); \
		AUDIOC_DBG_IND(); \
		AUDIOC_DBG_BRK(); \
		} \
	} while (0)
#define AUDIOC_POSTCOND(cond) \
	do { \
		if (! (cond)) { \
		AUDIOC_LOG("AC_POSTCOND(" #cond ") @ %s: line %u failed\n", \
		    __FILE__, __LINE__); \
		AUDIOC_DBG_IND(); \
		AUDIOC_DBG_BRK(); \
		} \
	} while (0)
#define AUDIOC_ASSERT(cond) \
	do { \
		if (! (cond)) { \
		AUDIOC_LOG("AC_ASSERT(" #cond ") @ %s: line %u failed\n", \
		    __FILE__, __LINE__); \
		AUDIOC_DBG_IND(); \
		AUDIOC_DBG_BRK(); \
		} \
	} while (0)
#else

#define AUDIOC_ASSERT(cond)

#endif /* ifdef AUDIOC_DEBUG */

#define AC_ASSERT AUDIOC_ASSERT
#define AC_PRECOND AUDIOC_PRECOND
#define AC_POSTCOND AUDIOC_POSTCOND

#define AC_LOG AUDIOC_LOG

#endif /* ifndef _AUDIOC_HPP */
