智也 大野 / Mbed 2 deprecated HeptaAccel

Dependencies:   mbed PowerControl SDFileSystem

Fork of HeptaAccel by 智也 大野

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers HeptaVoice.h Source File

HeptaVoice.h

00001 #include "mbed.h"
00002 
00003 #pragma once
00004 
00005 #define AQTK_I2C_ADDR (0x2E<<1)
00006 #define AQTK_STARTUP_WAIT_MS 80
00007 #define AQTK_POLL_WAIT_MS 10
00008 
00009 /** HeptaVoice class
00010  *
00011  * AquesTalk pico LSI I2C interface
00012  * Example:
00013  * @code
00014  *      #include "HeptaVoice.h"
00015  *      HeptaVoice talk(P0_10,P0_11); // I2C sda scl
00016  *      
00017  *      int main() {
00018  *          talk.Synthe("konnichiwa.");
00019  *          for(int n = 1; ; n++) {
00020  *              char buf[32];
00021  *              snprintf(buf, sizeof(buf), "<NUMK VAL=%d>.", n);
00022  *              talk.Synthe(buf);
00023  *          }
00024  *      } 
00025  * @endcode
00026  *
00027  */
00028 class HeptaVoice {
00029 public:
00030     /** Create a AquesTalk pico LSI I2C interface
00031      *
00032      * @param sda  I2C data pin
00033      * @param scl  I2C clock pin
00034      * @param addr I2C address
00035      */
00036     HeptaVoice(PinName sda, PinName scl, int addr = AQTK_I2C_ADDR);
00037     bool IsActive(int timeout_ms = 500);
00038     void Synthe(const char* msg);
00039     void Write(const char* msg);
00040     bool IsBusy();
00041 private:
00042     int _addr;
00043     I2C _i2c; 
00044     Timer _poll_wait;
00045 };