ece312/final_project/comms/comms.c

35 lines
756 B
C

#include "comms.h"
inline void comms_send_command(comms_cmd_t cmd) {
while (! (UCSRA & (1 << UDRE)));
UDR = cmd;
}
inline void comms_add_file(uint8_t id, char* filename) {
uint8_t len = strlen(filename);
comms_send_command(COMMS_CMD_ADD_FILE);
comms_send_command((comms_cmd_t) id);
uint8_t i = 0;
while (i < len) {
comms_send_command((comms_cmd_t) filename[i]);
}
}
inline void comms_select_file(uint8_t id) {
comms_send_command(COMMS_CMD_SELECT_FILE);
comms_send_command((comms_cmd_t) id);
}
inline void comms_clear() {
comms_send_command(COMMS_CMD_CLR);
}
inline void comms_play() {
comms_send_command(COMMS_CMD_PLAY);
}
inline void comms_pause() {
comms_send_command(COMMS_CMD_PLAY);
}