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:359
int writeData(char *buffer, int len)
Definition: wt5001.cxx:121
bool stop()
Definition: wt5001.cxx:221
bool getNumFiles(WT5001_PLAYSOURCE_T psrc, uint16_t *numf)
Definition: wt5001.cxx:493
~WT5001()
Definition: wt5001.cxx:69
uint8_t getVolume()
Definition: wt5001.cxx:452
WT5001(int uart)
Definition: wt5001.cxx:37
int readData(char *buffer, int len)
Definition: wt5001.cxx:100
uint8_t getPlayState()
Definition: wt5001.cxx:484
bool setupTty(speed_t baud=B9600)
Definition: wt5001.cxx:144
C++ API wrapper for the bh1749 driver.
Definition: a110x.hpp:29
bool play(WT5001_PLAYSOURCE_T psrc, uint16_t index)
Definition: wt5001.cxx:188
bool setAlarm(uint8_t hour, uint8_t minute, uint8_t second)
Definition: wt5001.cxx:396
bool next()
Definition: wt5001.cxx:236
bool dataAvailable(unsigned int millis)
Definition: wt5001.cxx:77
uint16_t getCurrentFile()
Definition: wt5001.cxx:570
bool queue(uint16_t index)
Definition: wt5001.cxx:309
bool getTime(uint8_t *hour, uint8_t *minute, uint8_t *second)
Definition: wt5001.cxx:606
bool checkResponse(WT5001_OPCODE_T opcode)
Definition: wt5001.cxx:174
API for the WT5001 Serial MP3 Module.
Definition: wt5001.hpp:74
bool setVolume(uint8_t vol)
Definition: wt5001.cxx:281
bool insert(uint16_t index)
Definition: wt5001.cxx:342
bool setPlayMode(WT5001_PLAYMODE_T pm)
Definition: wt5001.cxx:326
bool clearAlarm()
Definition: wt5001.cxx:414
bool pause()
Definition: wt5001.cxx:266
bool getDate(uint16_t *year, uint8_t *month, uint8_t *day)
Definition: wt5001.cxx:579
bool previous()
Definition: wt5001.cxx:251
bool setTime(uint8_t hour, uint8_t minute, uint8_t second)
Definition: wt5001.cxx:378