ece312/final_project/comms/comms.h

46 lines
1.1 KiB
C

#ifndef COMMS_H_
#define COMMS_H_
#include <avr/io.h>
#include <string.h>
/**
* Our format goes like this:
*
* 1 byte command, with data after
*/
typedef enum {
COMMS_CMD_CLR = 0U, //! Clears LCD and all file names
COMMS_CMD_ADD_FILE, //! Adds a file to the list of files to display, data is 1 byte for ID, 1 byte for strlen, n bytes for string
COMMS_CMD_SELECT_FILE, //! selects a file from the given list to play, data is 1 byte for id
COMMS_CMD_PLAY, //! Starts playing file
COMMS_CMD_PAUSE //! pauses playing file
} comms_cmd_t;
/** @brief Inline function to send commands and values.
*/
inline void comms_send_command(comms_cmd_t cmd);
/** @brief Adds a file to the list on the LCD side.
*/
inline void comms_add_file(uint8_t id, char* filename);
/** @brief Selects a file from the list on the DAC side.
*/
inline void comms_select_file(uint8_t id);
/** @brief Clears the LCD list of files.
*/
inline void comms_clear();
/** @brief Starts playing song.
*/
inline void comms_play();
/** @brief Pauses playing song.
*/
inline void comms_pause();
#endif