Browse Source

Fix touch sensor hardware wiring

main
Hendrik Langer 8 years ago
parent
commit
abbd05521b
  1. 2
      README.md
  2. 2
      src/keyboard.cpp
  3. 3
      src/main.cpp

2
README.md

@ -54,7 +54,7 @@ pip install -U platformio
platformio run -t upload && platformio device monitor -b 115200 platformio run -t upload && platformio device monitor -b 115200
``` ```
* Convert mp3 files: `sox ~/Music/input.mp3 -c 1 -r 11025 output.wav trim 0 30` * Convert mp3 files: `sox ~/Music/input.mp3 -c 1 -r 11025 -b 16 output.wav trim 0 30`
* SD card is tested with one FAT16 partion * SD card is tested with one FAT16 partion
## ToDo ## ToDo

2
src/keyboard.cpp

@ -37,6 +37,8 @@ static void tp_example_rtc_intr(void *arg) {
} }
bool Keyboard::getTouchDetected(uint8_t pad) { bool Keyboard::getTouchDetected(uint8_t pad) {
if (pad==8) pad=9; // fix hardware wiring
if (pad==1) pad=8;
bool res = s_pad_activated[pad]; bool res = s_pad_activated[pad];
s_pad_activated[pad] = false; s_pad_activated[pad] = false;
return res; return res;

3
src/main.cpp

@ -54,7 +54,8 @@ void loop()
for(int i=0; i<=9; i++) { for(int i=0; i<=9; i++) {
if (keyboard.getTouchDetected(i) == true) { if (keyboard.getTouchDetected(i) == true) {
touched = true; touched = true;
Serial.println("touch"); Serial.print("touch ");
Serial.println(i, DEC);
if (sound.playing == false) { if (sound.playing == false) {
Serial.println("new task"); Serial.println("new task");
xTaskCreate(&(Sound::buffer_refill_task), "buffer_refill_task", 4096, (void*)soundFile[i/3][i%3], 5, &xTaskSound); xTaskCreate(&(Sound::buffer_refill_task), "buffer_refill_task", 4096, (void*)soundFile[i/3][i%3], 5, &xTaskSound);

Loading…
Cancel
Save