-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
1,156 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
# Metwork | ||
# Metwork | ||
|
||
## Expressif 32 | ||
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/ | ||
|
||
## TTGO | ||
https://github.com/Xinyuan-LilyGO/TTGO_TWatch_Library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "config.h" | ||
#include <Arduino.h> | ||
#include <TTGO.h> | ||
|
||
#include <AudioFileSourcePROGMEM.h> | ||
#include "AudioGeneratorWAV.h" | ||
#include <AudioOutputI2S.h> | ||
#include "ESP8266SAM.h" | ||
#include "sound_beep.h" | ||
|
||
TTGOClass *ttgo; | ||
AudioGeneratorWAV *wav; | ||
AudioFileSourcePROGMEM *file; | ||
AudioOutputI2S *out; | ||
ESP8266SAM *sam; | ||
|
||
void sound_speak(const char *str) | ||
{ | ||
log_i("Speak text", str); | ||
sam->Say(out, str); | ||
out->stop(); | ||
} | ||
|
||
void sound_play_beep() | ||
{ | ||
log_i("Sound play beep"); | ||
file = new AudioFileSourcePROGMEM(beep_wav, beep_wav_len); | ||
wav->begin(file, out); | ||
} | ||
|
||
void sound_setup() | ||
{ | ||
TTGOClass *ttgo = TTGOClass::getWatch(); | ||
ttgo->enableLDO3(); // Turn on the audio power | ||
sam = new ESP8266SAM(); | ||
sam->SetVoice(sam->VOICE_SAM); | ||
wav = new AudioGeneratorWAV(); | ||
out = new AudioOutputI2S(); | ||
out->SetPinout(TWATCH_DAC_IIS_BCK, TWATCH_DAC_IIS_WS, TWATCH_DAC_IIS_DOUT); | ||
out->SetGain(0.1); | ||
sound_speak("Hi, how are you?"); | ||
} | ||
|
||
void sound_loop() | ||
{ | ||
if (wav->isRunning() && !wav->loop()) | ||
{ | ||
log_i("stop playing wav sound"); | ||
wav->stop(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <Arduino.h> | ||
|
||
#ifndef _SOUND_H | ||
#define _SOUND_H | ||
|
||
/* | ||
* Play a sound | ||
*/ | ||
void sound_setup(); | ||
void sound_loop(); | ||
/** | ||
* @brief speak | ||
* | ||
* @param str the text to be spoken | ||
*/ | ||
void sound_speak(const char *str); | ||
void sound_play_beep(); | ||
|
||
#endif // _SOUND_H |
Oops, something went wrong.