AquesTalk pico LSI I2C interface

音声合成LSI AquesTalk pico ATP3011のI2Cインターフェースです。

main.cpp

#include "mbed.h"
#include "ATP3011.h"
ATP3011 talk(P0_0, P0_1); // sda,scl LPC810
RawSerial pc(P0_4, P0_6); // tx,rx

int main()
{
    if (talk.IsActive()) {
        pc.puts("ATP3011 OK\r\n");
    } else {
        pc.puts("ATP3011 NG\r\n");
        while(1); // forever
    }
    const char* msg = "konnitiwa.";
    pc.puts(msg);pc.puts("\r\n");
    talk.Synthe(msg);
    char buf[32];
    for(int n = 1; ; n++) {
        snprintf(buf, sizeof(buf), "<NUMK VAL=%d>.", n);
        pc.puts(buf);pc.puts("\r\n");
        talk.Synthe(buf);
    }
}


参考:
[Arduino] AquesTalk pico LSI を I2C で制御する | N.Yamazaki's blog
音声記号列生成 Webサービス - AquesTalk - 株式会社アクエスト

Committer:
va009039
Date:
Tue Jan 07 23:57:49 2014 +0000
Revision:
0:afbfc810f82e
first commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
va009039 0:afbfc810f82e 1 #include "mbed.h"
va009039 0:afbfc810f82e 2 #pragma once
va009039 0:afbfc810f82e 3
va009039 0:afbfc810f82e 4 #define AQTK_I2C_ADDR (0x2E<<1)
va009039 0:afbfc810f82e 5 #define AQTK_STARTUP_WAIT_MS 80
va009039 0:afbfc810f82e 6 #define AQTK_POLL_WAIT_MS 10
va009039 0:afbfc810f82e 7
va009039 0:afbfc810f82e 8 /** ATP3011 class
va009039 0:afbfc810f82e 9 *
va009039 0:afbfc810f82e 10 * AquesTalk pico LSI I2C interface
va009039 0:afbfc810f82e 11 * Example:
va009039 0:afbfc810f82e 12 * @code
va009039 0:afbfc810f82e 13 * #include "ATP3011.h"
va009039 0:afbfc810f82e 14 * ATP3011 talk(P0_10,P0_11); // I2C sda scl
va009039 0:afbfc810f82e 15 *
va009039 0:afbfc810f82e 16 * int main() {
va009039 0:afbfc810f82e 17 * talk.Synthe("konnichiwa.");
va009039 0:afbfc810f82e 18 * for(int n = 1; ; n++) {
va009039 0:afbfc810f82e 19 * char buf[32];
va009039 0:afbfc810f82e 20 * snprintf(buf, sizeof(buf), "<NUMK VAL=%d>.", n);
va009039 0:afbfc810f82e 21 * talk.Synthe(buf);
va009039 0:afbfc810f82e 22 * }
va009039 0:afbfc810f82e 23 * }
va009039 0:afbfc810f82e 24 * @endcode
va009039 0:afbfc810f82e 25 *
va009039 0:afbfc810f82e 26 */
va009039 0:afbfc810f82e 27 class ATP3011 {
va009039 0:afbfc810f82e 28 public:
va009039 0:afbfc810f82e 29 /** Create a AquesTalk pico LSI I2C interface
va009039 0:afbfc810f82e 30 *
va009039 0:afbfc810f82e 31 * @param sda I2C data pin
va009039 0:afbfc810f82e 32 * @param scl I2C clock pin
va009039 0:afbfc810f82e 33 * @param addr I2C address
va009039 0:afbfc810f82e 34 */
va009039 0:afbfc810f82e 35 ATP3011(PinName sda, PinName scl, int addr = AQTK_I2C_ADDR);
va009039 0:afbfc810f82e 36 bool IsActive(int timeout_ms = 500);
va009039 0:afbfc810f82e 37 void Synthe(const char* msg);
va009039 0:afbfc810f82e 38 void Write(const char* msg);
va009039 0:afbfc810f82e 39 bool IsBusy();
va009039 0:afbfc810f82e 40 private:
va009039 0:afbfc810f82e 41 int _addr;
va009039 0:afbfc810f82e 42 I2C _i2c;
va009039 0:afbfc810f82e 43 Timer _poll_wait;
va009039 0:afbfc810f82e 44 };