diff --git a/src/hardware.h b/src/hardware.h new file mode 100644 index 0000000..a1ee216 --- /dev/null +++ b/src/hardware.h @@ -0,0 +1,33 @@ +#ifndef _HARDWARE_H +#define _HARDWARE_H + +/* Touch sensors keypad + * PCB Layout: see ESP32 Datasheet A.2. PCB Layout + */ +#define TOUCH_PAD_NUM 10 + +//Touch0 GPIO 4 +//Touch1 GPIO 0 /* don't use: pullup on dev board */ +//Touch2 GPIO 2 /* don't use: pullup on dev board */ +//Touch3 GPIO15 +//Touch4 GPIO13 +//Touch5 GPIO12 +//Touch6 GPIO14 +//Touch7 GPIO27 +//Touch8 GPIO33 +//Touch9 GPIO32 + +#define LED_PIN 21 + +/* SD card + */ +#define PIN_SD_CD 17 +#define PIN_SD_CS 5 + +/* I2S + */ +#define I2S_NUM 0 + +#define BUF_LENGTH 1024 + +#endif /* _HARDWARE_H */ diff --git a/src/keyboard.h b/src/keyboard.h index d6cdf69..4b13ce1 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -2,8 +2,8 @@ #define _KEYBOARD_H #include "driver/touch_pad.h" +#include "hardware.h" -#define TOUCH_PAD_NUM 10 static bool s_pad_activated[TOUCH_PAD_NUM]; diff --git a/src/main.cpp b/src/main.cpp index b2be7b1..fe01ebd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,14 +7,13 @@ */ #include "Arduino.h" +#include "hardware.h" #include "keyboard.h" #include "sdcard.h" #include "sound.h" #include "ringbuf.h" #define VERSION "0.0" -#define LED_PIN 21 -#define BUF_LENGTH 1024 #define WIFI_SSID "ssid" #define WIFI_PASSWORD "password" diff --git a/src/sdcard.cpp b/src/sdcard.cpp index cc84e6e..8b2f6ea 100644 --- a/src/sdcard.cpp +++ b/src/sdcard.cpp @@ -10,13 +10,13 @@ #include "SD.h" #include "SPI.h" +#include "hardware.h" #include "sdcard.h" #include "sound.h" using namespace std; static const char* TAG = "SDCard"; -#define PIN_SD_CD 17 SDCard::SDCard() { } @@ -26,7 +26,7 @@ void SDCard::mount() { if (!digitalRead(PIN_SD_CD)) { Serial.println("No card detected!"); } - if(!SD.begin(5)){ + if(!SD.begin(PIN_SD_CS)){ Serial.println("Card Mount Failed"); return; } diff --git a/src/sound.h b/src/sound.h index 452f5a9..108f7ad 100644 --- a/src/sound.h +++ b/src/sound.h @@ -4,8 +4,7 @@ #include "Arduino.h" #include "driver/i2s.h" - -#define I2S_NUM 0 +#include "hardware.h" typedef struct {