/*This file is prepared for Doxygen automatic documentation generation.*/
/*! \file ******************************************************************
 *
 * \brief Controller interface
 *
 * - Compiler:           IAR EWAVR32 and GNU GCC for AVR32
 * - Supported devices:  All AVR32 devices with a USB module can be used.
 * - AppNote:
 *
 * \author               Atmel Corporation: http://www.atmel.com \n
 *                       Support and FAQ: http://support.atmel.no/
 *
 ***************************************************************************/

/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 *
 * 3. The name of Atmel may not be used to endorse or promote products derived
 * from this software without specific prior written permission.
 *
 * 4. This software may only be redistributed and used in connection with an Atmel
 * AVR product.
 *
 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
 *
 */
#ifndef _CONTROLLER_H_
#define _CONTROLLER_H_

#include "compiler.h"
#include "gui.h"

/*! \name Constructor/Destructor
 */
//! \{
/*! \brief Initialization function of the controller interface.
 *
 * \param fcpu_hz CPU frequency.
 * \param fhsb_hz HSB frequency.
 * \param fpbb_hz PBB frequency.
 * \param fpba_hz PBA frequency.
 */
void controller_init(U32 fcpu_hz, U32 fhsb_hz, U32 fpbb_hz, U32 fpba_hz);
/*! \brief Shutdown the controller.
 */
void controller_shutdown(void);
// \}

/*! \brief Reset the key state.
 */
void controller_clear(void);

/*! \name Navigation view
 */
//! \{
/*! \brief This function is called to check if the user has pressed the previous
 *         file selection key.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_navigation_cursor_previous(void);

/*! \brief This function is called to check if the user has pressed the next
 *         file selection key.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_navigation_cursor_next(void);

/*! \brief This function is called to check if the user has pressed the
 *         go to parent directory key.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_navigation_go_to_parent_directory(void);

/*! \brief This function is called to check if the user has pressed the
 *         change directory key.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_navigation_change_directory(void);

/*! \name Playback view
 */
//! \{
/*! \brief This function is called to check if the user has pressed the
 *         play/pause key.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_playback_toggle_play_pause(void);

/*! \brief This function is called to check if the user has pressed the
 *         increase volume key.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_playback_increase_volume(void);

/*! \brief This function is called to check if the user has pressed the
 *         decrease volume key.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_playback_decrease_volume(void);

/*! \brief This function is called to check if the user has pressed the
 *         previous track key.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_playback_previous_track(void);

/*! \brief This function is called to check if the user has pressed the
 *         next track key.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_playback_next_track(void);

/*! \brief This function is called to check if the user has pressed the
 *         fast forward key.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_playback_ffw(Bool new_track);

/*! \brief This function is called to check if the user has pressed the
 *         fast rewind key.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_playback_frw(Bool new_track);

// \}

/*! \name Configuration view
 */
//! \{
/*! \brief This function is called to check if the user has pressed the
 *         configuration change key.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_config_change_mode(void);

/*! \brief This function is called to check if the user has pressed the
 *         next option key.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_config_next_option(void);

/*! \brief This function is called to check if the user has pressed the
 *         previous option key.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_config_previous_option(void);

/*! \brief This function is called to check if the user has pressed the
 *         play selected file key.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_navigation_play(void);
//! \}

/*! \name View switching
 */
//! \{
/*! \brief This function is called to check if the user has requested to move to
 *         the navigation view.
 *
 * \param view The current view.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_switch_to_navigation_view(enum gui_update_view view);

/*! \brief This function is called to check if the user has requested to move to
 *         the playback view.
 *
 * \param view The current view.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_switch_to_playback_view(enum gui_update_view view);

/*! \brief This function is called to check if the user has requested to move to
 *         the configuration view.
 *
 * \param view The current view.
 *
 * \return TRUE if the key has been pressed.
 *         FALSE otherwise.
 */
Bool controller_switch_to_config_view(enum gui_update_view view);
// \}

#endif // _CONTROLLER_H_
