2019-08-02 21:48:36 +00:00
|
|
|
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
2019-08-04 11:42:07 +00:00
|
|
|
// Pins according to https://www.instructables.com/id/NodeMCU-ESP8266-Details-and-Pinout/
|
|
|
|
// D0 = 16
|
|
|
|
// D1 = 5
|
|
|
|
// D2 = 4
|
|
|
|
// D3 = 0
|
|
|
|
// D4 = 2
|
|
|
|
// D5 = 14
|
|
|
|
// D6 = 12
|
|
|
|
// D7 = 13
|
|
|
|
// D8 = 15
|
|
|
|
// A0 = 17
|
|
|
|
// Other usable pins:
|
|
|
|
// 6, 7, 8, 11 not readable
|
|
|
|
// 1, 3, 6, 7, 8, 11 nor writable -> 1 (TX) and 3 (RX) can be used read-only
|
|
|
|
// 9 -> S2
|
|
|
|
// 10 -> S3
|
|
|
|
#define RX 3
|
|
|
|
#define TX 1
|
|
|
|
|
2019-11-10 13:45:33 +00:00
|
|
|
// Pins for MCP23017
|
|
|
|
#define GPA0 0
|
|
|
|
#define GPA1 1
|
|
|
|
#define GPA2 2
|
|
|
|
#define GPA3 3
|
|
|
|
#define GPA4 4
|
|
|
|
#define GPA5 5
|
|
|
|
#define GPA6 6
|
|
|
|
#define GPA7 7
|
|
|
|
#define GPB0 8
|
|
|
|
#define GPB1 9
|
|
|
|
#define GPB2 10
|
|
|
|
#define GPB3 11
|
|
|
|
#define GPB4 12
|
|
|
|
#define GPB5 13
|
|
|
|
#define GPB6 14
|
|
|
|
#define GPB7 15
|
|
|
|
|
2019-08-09 04:27:33 +00:00
|
|
|
#define SHOW_DEBUG
|
2019-08-12 18:15:00 +00:00
|
|
|
//#define SHOW_TRACE
|
2019-08-13 17:39:03 +00:00
|
|
|
#define FTP_DEBUG
|
2019-08-12 18:15:00 +00:00
|
|
|
|
|
|
|
#define WIFI_SSID "Schlenz"
|
|
|
|
#define WIFI_PASS "1410WischlingenPanda"
|
|
|
|
|
|
|
|
#define VS1053_SLEEP_DELAY 5000
|
2019-08-14 19:01:01 +00:00
|
|
|
#define MQTT_REPORT_INTERVAL 10000
|
2019-08-09 04:27:33 +00:00
|
|
|
|
2019-11-10 13:45:33 +00:00
|
|
|
#define PIN_SD_CS(x) (_mcp->digitalWrite(GPB3, x))
|
|
|
|
#define PIN_SD_CS_SETUP() (_mcp->pinMode(GPB3, OUTPUT))
|
|
|
|
|
|
|
|
#define PIN_VS1053_XCS(x) (digitalWrite(D8, x))
|
|
|
|
#define PIN_VS1053_XCS_SETUP() (pinMode(D8, OUTPUT))
|
|
|
|
|
|
|
|
#define PIN_VS1053_XRESET(x) (_mcp->digitalWrite(GPB7, x))
|
|
|
|
#define PIN_VS1053_XRESET_SETUP() (_mcp->pinMode(GPB7, OUTPUT))
|
|
|
|
|
|
|
|
#define PIN_VS1053_XDCS(x) (digitalWrite(D3, x))
|
|
|
|
#define PIN_VS1053_XDCS_SETUP() (pinMode(D3, OUTPUT))
|
|
|
|
|
|
|
|
#define PIN_VS1053_DREQ() (_mcp->digitalRead(GPB2))
|
|
|
|
#define PIN_VS1053_DREQ_SETUP() (_mcp->pinMode(GPB2, INPUT))
|
|
|
|
|
|
|
|
#define PIN_RC522_CS(x) (digitalWrite(D0, x))
|
|
|
|
#define PIN_RC522_CS_SETUP() (pinMode(D0, OUTPUT))
|
|
|
|
|
|
|
|
#define PIN_SPEAKER_L(x) (_mcp->digitalWrite(GPB5, x))
|
|
|
|
#define PIN_SPEAKER_L_SETUP() (_mcp->pinMode(GPB5, OUTPUT))
|
2019-08-04 11:42:07 +00:00
|
|
|
|
2019-11-10 13:45:33 +00:00
|
|
|
#define PIN_SPEAKER_R(x) (_mcp->digitalWrite(GPB6, x))
|
|
|
|
#define PIN_SPEAKER_R_SETUP() (_mcp->pinMode(GPB6, OUTPUT))
|
2019-08-02 21:48:36 +00:00
|
|
|
|
2019-11-10 13:45:33 +00:00
|
|
|
#define BTN_PREV() ( ! _mcp->digitalRead(GPA0))
|
|
|
|
#define BTN_PREV_SETUP() {_mcp->pinMode(GPA0, INPUT); _mcp->pullUp(GPA0, HIGH);}
|
|
|
|
|
|
|
|
#define BTN_VOL_UP() ( ! _mcp->digitalRead(GPA1))
|
|
|
|
#define BTN_VOL_UP_SETUP() {_mcp->pinMode(GPA1, INPUT); _mcp->pullUp(GPA1, HIGH);}
|
|
|
|
|
|
|
|
#define BTN_VOL_DOWN() ( ! _mcp->digitalRead(GPA2))
|
|
|
|
#define BTN_VOL_DOWN_SETUP() {_mcp->pinMode(GPA2, INPUT); _mcp->pullUp(GPA2, HIGH);}
|
|
|
|
|
|
|
|
#define BTN_NEXT() ( ! _mcp->digitalRead(GPA3))
|
|
|
|
#define BTN_NEXT_SETUP() {_mcp->pinMode(GPA3, INPUT); _mcp->pullUp(GPA3, HIGH);}
|
|
|
|
|
|
|
|
|
|
|
|
#define MCP_I2C_ADDR 7
|
2019-08-02 21:48:36 +00:00
|
|
|
|
2019-08-11 15:15:22 +00:00
|
|
|
#define NUM_BUTTONS 4
|
|
|
|
|
|
|
|
#define DEBOUNCE_MILLIS 200
|
2019-09-03 04:05:26 +00:00
|
|
|
#define VOLUME_DEFAULT 230
|
|
|
|
#define VOLUME_MIN 190
|
|
|
|
#define VOLUME_MAX 255
|
2019-08-06 18:50:11 +00:00
|
|
|
#define VOLUME_STEP 0x08
|
2019-08-08 03:31:27 +00:00
|
|
|
|
2019-11-10 13:45:33 +00:00
|
|
|
#define MCP_SPI_SETTING_DELAY 1
|
|
|
|
|
2019-08-08 04:49:35 +00:00
|
|
|
#define RFID_SCAN_INTERVAL 100
|
2019-08-09 04:27:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Other definitions
|
|
|
|
#define INFO(x, ...) Serial.printf(x, ##__VA_ARGS__)
|
|
|
|
#define ERROR(x, ...) Serial.printf(x, ##__VA_ARGS__)
|
|
|
|
|
|
|
|
#ifdef SHOW_DEBUG
|
|
|
|
#define DEBUG(x, ...) Serial.printf(x, ##__VA_ARGS__)
|
|
|
|
#else
|
|
|
|
#define DEBUG(x, ...) while(0) {}
|
|
|
|
#endif
|
2019-08-12 18:15:00 +00:00
|
|
|
|
|
|
|
#ifdef SHOW_TRACE
|
|
|
|
#define TRACE(x, ...) Serial.printf(x, ##__VA_ARGS__)
|
|
|
|
#else
|
|
|
|
#define TRACE(x, ...) while(0) {}
|
|
|
|
#endif
|