Battery

Dependencies:   mbed PowerControl SDFileSystem

Fork of HeptaBattery by 智也 大野

hepta_sat/HeptaVoice.h

Committer:
tomoya123
Date:
2016-12-13
Revision:
1:166ddf929155
Parent:
0:d53e9c6fc771

File content as of revision 1:166ddf929155:

#include "mbed.h"

#pragma once

#define AQTK_I2C_ADDR (0x2E<<1)
#define AQTK_STARTUP_WAIT_MS 80
#define AQTK_POLL_WAIT_MS 10

/** HeptaVoice class
 *
 * AquesTalk pico LSI I2C interface
 * Example:
 * @code
 *      #include "HeptaVoice.h"
 *      HeptaVoice talk(P0_10,P0_11); // I2C sda scl
 *      
 *      int main() {
 *          talk.Synthe("konnichiwa.");
 *          for(int n = 1; ; n++) {
 *              char buf[32];
 *              snprintf(buf, sizeof(buf), "<NUMK VAL=%d>.", n);
 *              talk.Synthe(buf);
 *          }
 *      } 
 * @endcode
 *
 */
class HeptaVoice {
public:
    /** Create a AquesTalk pico LSI I2C interface
     *
     * @param sda  I2C data pin
     * @param scl  I2C clock pin
     * @param addr I2C address
     */
    HeptaVoice(PinName sda, PinName scl, int addr = AQTK_I2C_ADDR);
    bool IsActive(int timeout_ms = 500);
    void Synthe(const char* msg);
    void Write(const char* msg);
    bool IsBusy();
private:
    int _addr;
    I2C _i2c; 
    Timer _poll_wait;
};