Battery_hex

Dependencies:   mbed PowerControl SDFileSystem

Fork of HeptaBattery_hex by 智也 大野

Committer:
tomoya123
Date:
Tue Dec 13 06:55:26 2016 +0000
Revision:
1:4e0d741b4ae2
Parent:
0:30e193b92735
Battery hex

Who changed what in which revision?

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