37 #include <sys/select.h>
38 #include <sys/types.h>
41 #include <mraa/uart.h>
43 const int WT5001_DEFAULT_UART = 0;
44 const int WT5001_MAX_VOLUME = 31;
47 const uint8_t WT5001_START = 0x7e;
48 const uint8_t WT5001_END = 0x7e;
78 typedef enum { NONE = 0x00,
90 COPY_UDISK2FLASH = 0xab,
97 CLEAR_ALARM_DUR = 0xb6,
99 READ_PLAY_STATE = 0xc2,
100 READ_SPI_NUMF = 0xc3,
102 READ_UDISK_NUMF = 0xc5,
103 READ_CUR_FNAME = 0xc6,
110 typedef enum { NORMAL = 0x00,
111 SINGLE_REPEAT = 0x01,
120 } WT5001_PLAYSOURCE_T;
152 int readData(
char *buffer,
int len);
187 bool play(WT5001_PLAYSOURCE_T psrc, uint16_t index);
230 bool queue(uint16_t index);
248 bool insert(uint16_t index);
258 bool setDate(uint16_t year, uint8_t month, uint8_t day);
268 bool setTime(uint8_t hour, uint8_t minute, uint8_t second);
278 bool setAlarm(uint8_t hour, uint8_t minute, uint8_t second);
326 bool getNumFiles(WT5001_PLAYSOURCE_T psrc, uint16_t *numf);
361 bool getDate(uint16_t *year, uint8_t *month, uint8_t *day);
371 bool getTime(uint8_t *hour, uint8_t *minute, uint8_t *second);
375 int ttyFd() {
return m_ttyFd; };
378 mraa_uart_context m_uart;
bool setDate(uint16_t year, uint8_t month, uint8_t day)
Definition: wt5001.cxx:360
int writeData(char *buffer, int len)
Definition: wt5001.cxx:122
bool stop()
Definition: wt5001.cxx:222
bool getNumFiles(WT5001_PLAYSOURCE_T psrc, uint16_t *numf)
Definition: wt5001.cxx:494
~WT5001()
Definition: wt5001.cxx:69
uint8_t getVolume()
Definition: wt5001.cxx:453
WT5001(int uart)
Definition: wt5001.cxx:37
int readData(char *buffer, int len)
Definition: wt5001.cxx:101
uint8_t getPlayState()
Definition: wt5001.cxx:485
bool setupTty(speed_t baud=B9600)
Definition: wt5001.cxx:145
bool play(WT5001_PLAYSOURCE_T psrc, uint16_t index)
Definition: wt5001.cxx:189
bool setAlarm(uint8_t hour, uint8_t minute, uint8_t second)
Definition: wt5001.cxx:397
bool next()
Definition: wt5001.cxx:237
bool dataAvailable(unsigned int millis)
Definition: wt5001.cxx:77
uint16_t getCurrentFile()
Definition: wt5001.cxx:571
bool queue(uint16_t index)
Definition: wt5001.cxx:310
bool getTime(uint8_t *hour, uint8_t *minute, uint8_t *second)
Definition: wt5001.cxx:607
bool checkResponse(WT5001_OPCODE_T opcode)
Definition: wt5001.cxx:175
API for the WT5001 Serial MP3 Module.
Definition: wt5001.h:74
bool setVolume(uint8_t vol)
Definition: wt5001.cxx:282
bool insert(uint16_t index)
Definition: wt5001.cxx:343
bool setPlayMode(WT5001_PLAYMODE_T pm)
Definition: wt5001.cxx:327
bool clearAlarm()
Definition: wt5001.cxx:415
bool pause()
Definition: wt5001.cxx:267
bool getDate(uint16_t *year, uint8_t *month, uint8_t *day)
Definition: wt5001.cxx:580
bool previous()
Definition: wt5001.cxx:252
bool setTime(uint8_t hour, uint8_t minute, uint8_t second)
Definition: wt5001.cxx:379