ChargeControl

Dependencies:   mbed PowerControl SDFileSystem

Fork of ChargeControl by 智也 大野

Committer:
tomoya123
Date:
Tue Dec 13 07:44:05 2016 +0000
Revision:
1:cbbad81dc88d
Parent:
0:0842f00470eb
ChargeControl

Who changed what in which revision?

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