
#include <libsaria/callback.h>
#include <libsaria/print.h>
#include <ocarina/ocarina.h>
#include <ocarina/button.h>
#include <ocarina/library.h>

void cb_play()
{
	println("Ocarina PLAY callback!");
	hide_button_list(PLAY_BUTTON_LIST);
	show_button_list(PAUSE_BUTTON_LIST);
}

void cb_pause()
{
	println("Ocarina PAUSE callback!");
	hide_button_list(PAUSE_BUTTON_LIST);
	show_button_list(PLAY_BUTTON_LIST);
}

void cb_idle_task_queued()
{
	println("Ocarina IDLE_TASK_QUEUED callback!");
	ocarina_idle_add();
}

void cb_library_refresh()
{
	println("Ocarina LIBRARY_REFRESH callback!");
	ocarina_library_refresh();
}

static void add_callback(callback_t type, void (* func)())
{
	register_callback(type, func);
}

void setup_callbacks()
{
	println("Ocarina setting up callbacks");
	add_callback(PLAY, cb_play);
	add_callback(PAUSE, cb_pause);
	add_callback(IDLE_TASK_QUEUED, cb_idle_task_queued);
	add_callback(LIBRARY_REFRESH, cb_library_refresh);
}
