Browse Source

* Add support for SD MMC 1 Bit mode:

This mode doubles the SD card speed (FTP upload speed ~350 kB/s compared to ~180 kB/s in SPI mode). Needs one PIN less but fixed PIN assignments

Add support for the PN5180 RFID reader:
PN5180 has better RFID range/sensitivity and can read ISO-15693 / iCode SLIX2 aka Tonies
master
tueddy 5 years ago
parent
commit
dcba3583ec
  1. 35
      README.md
  2. 5
      platformio.ini
  3. 204
      src/main.cpp
  4. 29
      src/settings.h

35
README.md

@ -20,6 +20,8 @@ Finally, the long announced Tonuino-PCB for Wemos' Lolin32 is [there](https://gi
* 08.12.2020: Reworked MQTT-timeout-Management
* 09.12.2020: mDND-feature added. If tonuino's name is "tonuino", you can use `tonuino.local` instead it's of IP-address.
* 11.12.2020: Revised GUI-design + (untested) PCB added for Wemos Lolin D32 + gerberfiles for headphone-PCB
* 13.12.2020: Add SD-MMC 1 Bit mode: This mode needs one PIN less and has almost double speed than SPI mode
* 13.12.2020: Add support for the PN5180 reader. The PN5180 has better RFID range/sensitivity and can read ISO-15693 / iCode SLIX2 tags aka Tonies
More to come...
## Known bugs
@ -48,7 +50,8 @@ The heart of my project is an ESP32 on a [Wemos Lolin32 development-board](https
* [Buttons](https://de.aliexpress.com/item/32896285438.html)
* [Speaker](https://www.visaton.de/de/produkte/chassiszubehoer/breitband-systeme/fr-7-4-ohm)
* uSD-card: doesn't have to be a super-fast one; uC is limiting the throughput. Tested 32GB without any problems.
* uSD in SD-MMC (1 Bit) mode: Several devkits with onboard SD slot have support for this mode, e.g.: (https://de.aliexpress.com/item/4001229463219.html)
* optional replace the RFID-reader with a the better one: PN5180 comes with better RFID range, less power consumption and support for ISO-15693 / iCode SLIX2 tags (https://www.bing.com/shop?q=pn5180&FORM=SHOPTB)
Most of them can be ordered cheaper directly in China. It's just a give an short impression of the hardware; feel free to order where ever you want to. These are not affiliate-links.
## Getting Started
@ -104,6 +107,18 @@ Optionally, GPIO 17 can be used to drive a NPN-transistor (BC337-40) that pulls
This also works for a 3.3V-setup with IRF530NPBF (N-channel MOSFET) and NDP6020P (P-channel MOSFET). Resistor-values: R1: 100k, R2: omitted(!), R4: 100k, R5: 1k. A 3.3V-setup is helpful if you want to battery-power your Tonuino and 5V is not available in battery-mode. For example this is the case when using Wemos Lolin32 with only having LiPo connected. Please refer the schematics for my [Lolin32-PCB](https://github.com/biologist79/Tonuino-ESP32-I2S/blob/master/PCBs/Wemos%20Lolin32/Pictures/Tonuino-Lolin32-Schematics.pdf) for further informations.<br />
Advice: When powering a SD-card-reader solely with 3.3V, make sure to use one WITHOUT a voltage regulator. Or at least one with a pin dedicated for 3.3V (bypassing voltage regulator). This is because if 3.3V go through the voltage regulator a small voltage-drop will be introduced, which may lead to SD-malfunction as the resulting voltage is a bit too low. Vice versa if you want to connect your reader solely to 5V, make sure to have one WITH a voltage regulator :-).
## Wiring (SD card in 1 Bit SD-MMC mode) different to above
| ESP32 (GPIO) | Hardware | Pin | Comment |
| ------------- | --------------------- | ------ | ------------------------------------------------------------ |
| -- | SD-reader | CS | no CS required |
| 15 | SD-reader | MOSI | |
| 2 | SD-reader | MISO | 10K hardware pullup may be required |
| 14 | SD-reader | SCK | |
SD-MMC mode requires these fixed PIN's. SD-MMC mode is almost twice as fast than SPI mode.
You find a good comparasion of different SD card modes here: (https://www.instructables.com/Select-SD-Interface-for-ESP32/)
Advice: Double check that above PIN's not used in otherway (PREVIOUS_BUTTON is mounted to SD MISO in default settings.h)
## Wiring (1 SPI-instance) [EXPERIMENTAL, maybe not working!]
Basically the same as using 2 SPI-instances but...
In this case RFID-reader + SD-reader share SPI's SCK, MISO and MOSI. But make sure to use different CS-pins.
@ -143,6 +158,23 @@ In this case RFID-reader + SD-reader share SPI's SCK, MISO and MOSI. But make su
| 33 | Voltage-divider / BAT | | Optional: Voltage-divider to monitor battery-voltage |
| 22 | Headphone jack | | Optional: if pulled to ground, headphone-volume is set |
## Wiring (PN5180 instead of MFRC522) different to above
PN5180 reader needs two more PIN's, RESET and BUSY. Double check PIN conflicts!
| ESP32 (GPIO) | Hardware | Pin | Comment |
| ------------- | --------------------- | ------ | ------------------------------------------------------------ |
| 17 | PN5180 RFID-reader | 3.3V | Connect directly to GPIO 17 for power-saving when uC is off |
| GND | PN5180 RFID-reader | GND | |
| 21 | PN5180 RFID-reader | CS/SDA | Same as MFRC522. Don't share with SD! |
| 23 | PN5180 RFID-reader | MOSI | Same as MFRC522 |
| 19 | PN5180 RFID-reader | MISO | Same as MFRC522 |
| 18 | PN5180 RFID-reader | SCK | Same as MFRC522 |
| 16 | PN5180 RFID-reader | BUSY | be aware of SD MISO if running in SPI mode |
| 22 | PN5180 RFID-reader | RST | be aware of Headphone jack PIN |
## Wiring (custom) / different pinout
When using a develboard with for example SD-card-reader already integrated (Lolin D32 Pro), the pinouts described above my not fit; feel free to change them according your needs. Additionaly some boards may use one or some of the GPIOs I used for their internal purposes and that reason for are maybe not exposed via pin-headers. However, having them exposed doesn't mean they can be used without limits. This is because some GPIOs have to be logical LOW or HIGH at start for example and this is probably not the case when connecting stuff to it. Feel free to adjust the GPIOs proposed by me (but be adviced it could take a while to get it running). If you encounter problems please refer the board's manual first. <br />
[Here](https://github.com/biologist79/Tonuino-ESP32-I2S/tree/master/Hardware-Plaforms/ESP32-A1S-Audiokit) I described a solution for a board with many GPIOs used internally and a very limited number of GPIOs exposed. That's why I had to use different SPI-GPIOs for RFID as well. Please note I used a slightly modified [RFID-lib](https://github.com/biologist79/Tonuino-ESP32-I2S/tree/master/Hardware-Plaforms/ESP32-A1S-Audiokit/lib/MFRC522) there.
@ -161,6 +193,7 @@ Please note: via GUI upper and lower voltage cut-offs for visualisation of batte
* Enabling `SHUTDOWN_IF_SD_BOOT_FAILS` is really recommended if you run your Tonuino in battery-mode without having a restart-button exposed to the outside of Tonuino's enclosure. Because otherwise there's no way to restart your Tonuino and the error-state will remain until battery is empty (or you open the enclosure, hehe).
* Enabling `PLAY_LAST_RFID_AFTER_REBOOT` will tell Tonuino to remember the last RFID-tag played after next reboot. So rebooting Tonuino will end up in autoplay.
* If `MDNS_ENABLE` is enabled, your Tonuino is reachable via hostname.local. So if your Tonuino's hostname is 'tonuino', the address is `tonuino.local`.
* If you want to use the SD card in SD-MMC mode (double upload speed for FTP) use `SD_MMC_1BIT_MODE` and double check these PIN's are not used by other periperal
* Compile and upload the sketch.
## Starting Tonuino-ESP32 first time

5
platformio.ini

@ -18,16 +18,15 @@ monitor_speed = 115200
board_build.partitions = no_ota.csv
;board_build.partitions = min_spiffs.csv
upload_port = /dev/cu.SLAB_USBtoUART
monitor_port = /dev/cu.SLAB_USBtoUART
lib_deps =
https://github.com/schreibfaul1/ESP32-audioI2S.git
https://github.com/madhephaestus/ESP32Encoder.git
https://github.com/knolleary/pubsubclient.git
https://github.com/biologist79/ESP32FTPServer
https://github.com/tueddy/ESP32FTPServer.git
https://github.com/FastLED/FastLED.git
https://github.com/biologist79/rfid.git
https://github.com/tueddy/PN5180-Library.git
ESP Async WebServer
https://github.com/me-no-dev/AsyncTCP
https://github.com/bblanchon/ArduinoJson.git

204
src/main.cpp

@ -15,10 +15,21 @@
#endif
#include "Audio.h"
#include "SPI.h"
#include "SD.h"
#include "FS.h"
#ifdef SD_MMC_1BIT_MODE
#include "SD_MMC.h"
#else
#include "SD.h"
#endif
#include "esp_task_wdt.h"
#include <MFRC522.h>
#ifdef RFID_READER_TYPE_MFRC522
#include <MFRC522.h>
#endif
#ifdef RFID_READER_TYPE_PN5180
#include <PN5180.h>
#include <PN5180ISO14443.h>
#include <PN5180ISO15693.h>
#endif
#include <Preferences.h>
#ifdef MQTT_ENABLE
#include <PubSubClient.h>
@ -249,7 +260,9 @@ static const char restartWebsite[] PROGMEM = "<p>Der Tonuino wird neu gestartet.
// Audio/mp3
#ifndef SD_MMC_1BIT_MODE
SPIClass spiSD(HSPI);
#endif
TaskHandle_t mp3Play;
TaskHandle_t rfid;
#ifdef NEOPIXEL_ENABLE
@ -575,8 +588,11 @@ void parseSDFileList(fs::FS &fs, const char * dirname, const char * parent, uint
esp_task_wdt_reset();
if (pathValid(fileNameBuf)) {
sendWebsocketData(0, 31);
#ifdef SD_MMC_1BIT_MODE
appendNodeToJSONFile(SD_MMC, DIRECTORY_INDEX_FILE, fileNameBuf, parent, "folder" );
#else
appendNodeToJSONFile(SD, DIRECTORY_INDEX_FILE, fileNameBuf, parent, "folder" );
#endif
// check for next subfolder
if(levels){
parseSDFileList(fs, fileNameBuf, root.name(), levels -1);
@ -586,7 +602,7 @@ void parseSDFileList(fs::FS &fs, const char * dirname, const char * parent, uint
} else {
if (fileValid(fileNameBuf)) {
appendNodeToJSONFile(SD, DIRECTORY_INDEX_FILE, fileNameBuf, parent, "file" );
appendNodeToJSONFile(fs, DIRECTORY_INDEX_FILE, fileNameBuf, parent, "file" );
}
}
vTaskDelay(portTICK_PERIOD_MS*50);
@ -603,9 +619,15 @@ void parseSDFileList(fs::FS &fs, const char * dirname, const char * parent, uint
* is done.
*/
void createJSONFileList() {
#ifdef SD_MMC_1BIT_MODE
createFile(SD_MMC, DIRECTORY_INDEX_FILE, "[");
parseSDFileList(SD_MMC, "/", NULL, FS_DEPTH);
appendToFile(SD_MMC, DIRECTORY_INDEX_FILE, "]");
#else
createFile(SD, DIRECTORY_INDEX_FILE, "[");
parseSDFileList(SD, "/", NULL, FS_DEPTH);
appendToFile(SD, DIRECTORY_INDEX_FILE, "]");
#endif
isFirstJSONtNode = true;
sendWebsocketData(0,30);
}
@ -1543,7 +1565,11 @@ void playAudio(void *parameter) {
#ifdef NEOPIXEL_ENABLE
showRewind = true;
#endif
#ifdef SD_MMC_1BIT_MODE
audio.connecttoFS(SD_MMC, *(playProperties.playlist + playProperties.currentTrackNumber));
#else
audio.connecttoSD(*(playProperties.playlist + playProperties.currentTrackNumber));
#endif
loggerNl((char *) FPSTR(trackStart), LOGLEVEL_INFO);
trackCommand = 0;
continue;
@ -1666,13 +1692,21 @@ void playAudio(void *parameter) {
playProperties.playlistFinished = false;
} else {
// Files from SD
#ifdef SD_MMC_1BIT_MODE
if (!SD_MMC.exists(*(playProperties.playlist + playProperties.currentTrackNumber))) { // Check first if file/folder exists
#else
if (!SD.exists(*(playProperties.playlist + playProperties.currentTrackNumber))) { // Check first if file/folder exists
#endif
snprintf(logBuf, serialLoglength, "Datei/Ordner '%s' existiert nicht", *(playProperties.playlist + playProperties.currentTrackNumber));
loggerNl(logBuf, LOGLEVEL_ERROR);
playProperties.trackFinished = true;
continue;
} else {
#ifdef SD_MMC_1BIT_MODE
audio.connecttoFS(SD_MMC, *(playProperties.playlist + playProperties.currentTrackNumber));
#else
audio.connecttoSD(*(playProperties.playlist + playProperties.currentTrackNumber));
#endif
#ifdef NEOPIXEL_ENABLE
showPlaylistProgress = true;
#endif
@ -1718,6 +1752,7 @@ void playAudio(void *parameter) {
}
#ifdef RFID_READER_TYPE_MFRC522
// Instructs RFID-scanner to scan for new RFID-tags
void rfidScanner(void *parameter) {
static MFRC522 mfrc522(RFID_CS, RST_PIN);
@ -1780,7 +1815,112 @@ void rfidScanner(void *parameter) {
}
vTaskDelete(NULL);
}
#endif
#ifdef RFID_READER_TYPE_PN5180
// Instructs RFID-scanner to scan for new RFID-tags using PN5180
void rfidScanner(void *parameter) {
static PN5180ISO14443 nfc14443(RFID_CS, RFID_BUSY, RFID_RST);
static PN5180ISO15693 nfc15693(RFID_CS, RFID_BUSY, RFID_RST);
nfc14443.begin();
nfc14443.reset();
// show PN5180 reader version
uint8_t firmwareVersion[2];
nfc14443.readEEprom(FIRMWARE_VERSION, firmwareVersion, sizeof(firmwareVersion));
Serial.print(F("Firmware version="));
Serial.print(firmwareVersion[1]);
Serial.print(".");
Serial.println(firmwareVersion[0]);
// activate RF field
delay(4);
loggerNl((char *) FPSTR(rfidScannerReady), LOGLEVEL_DEBUG);
byte cardId[cardIdSize];
char *cardIdString;
for (;;) {
esp_task_wdt_reset();
vTaskDelay(10);
if ((millis() - lastRfidCheckTimestamp) >= RFID_SCAN_INTERVAL) {
// Reset the loop if no new card is present on the sensor/reader. This saves the entire process when idle.
lastRfidCheckTimestamp = millis();
// 1. check for an ISO-14443 card
nfc14443.reset();
nfc14443.setupRF();
uint8_t uid[10];
if (nfc14443.isCardPresent() && nfc14443.readCardSerial(uid)) {
cardIdString = (char *) malloc(cardIdSize*3 +1);
if (cardIdString == NULL) {
logger((char *) FPSTR(unableToAllocateMem), LOGLEVEL_ERROR);
#ifdef NEOPIXEL_ENABLE
showLedError = true;
#endif
continue;
}
uint8_t n = 0;
logger((char *) FPSTR(rfidTagDetected), LOGLEVEL_NOTICE);
for (uint8_t i=0; i<cardIdSize; i++) {
cardId[i] = uid[i];
snprintf(logBuf, serialLoglength, "%02x", cardId[i]);
logger(logBuf, LOGLEVEL_NOTICE);
n += snprintf (&cardIdString[n], sizeof(cardIdString) / sizeof(cardIdString[0]), "%03d", cardId[i]);
if (i<(cardIdSize-1)) {
logger("-", LOGLEVEL_NOTICE);
} else {
logger("\n", LOGLEVEL_NOTICE);
}
}
xQueueSend(rfidCardQueue, &cardIdString, 0);
continue;
}
// 2. check for an ISO-15693 card
nfc15693.reset();
nfc15693.setupRF();
// check for ICODE-SLIX2 password protected tag
// put your privacy password here, e.g.:
// https://de.ifixit.com/Antworten/Ansehen/513422/nfc+Chips+f%C3%BCr+tonies+kaufen
uint8_t password[] = {0x01, 0x02, 0x03, 0x04};
ISO15693ErrorCode myrc = nfc15693.disablePrivacyMode(password);
if (ISO15693_EC_OK == myrc) {
Serial.println("disable PrivacyMode successful");
}
// try to read ISO15693 inventory
ISO15693ErrorCode rc = nfc15693.getInventory(uid);
if (rc == ISO15693_EC_OK) {
cardIdString = (char *) malloc(cardIdSize*3 +1);
if (cardIdString == NULL) {
logger((char *) FPSTR(unableToAllocateMem), LOGLEVEL_ERROR);
#ifdef NEOPIXEL_ENABLE
showLedError = true;
#endif
continue;
}
uint8_t n = 0;
logger((char *) FPSTR(rfidTagDetected), LOGLEVEL_NOTICE);
for (uint8_t i=0; i<cardIdSize; i++) {
cardId[i] = uid[i];
snprintf(logBuf, serialLoglength, "%02x", cardId[i]);
logger(logBuf, LOGLEVEL_NOTICE);
n += snprintf (&cardIdString[n], sizeof(cardIdString) / sizeof(cardIdString[0]), "%03d", cardId[i]);
if (i<(cardIdSize-1)) {
logger("-", LOGLEVEL_NOTICE);
} else {
logger("\n", LOGLEVEL_NOTICE);
}
}
xQueueSend(rfidCardQueue, &cardIdString, 0);
}
}
}
vTaskDelete(NULL);
}
#endif
// This task handles everything for Neopixel-visualisation
#ifdef NEOPIXEL_ENABLE
@ -2264,7 +2404,11 @@ void trackQueueDispatcher(const char *_itemToPlay, const uint32_t _lastPlayPos,
publishMqtt((char *) FPSTR(topicPlaymodeState), playProperties.playMode, false);
#endif
if (_playMode != WEBSTREAM) {
#ifdef SD_MMC_1BIT_MODE
musicFiles = returnPlaylistFromSD(SD_MMC.open(filename));
#else
musicFiles = returnPlaylistFromSD(SD.open(filename));
#endif
} else {
musicFiles = returnPlaylistFromWebstream(filename);
}
@ -2990,8 +3134,12 @@ wl_status_t wifiManager(void) {
snprintf(logBuf, serialLoglength, "Aktuelle IP: %d.%d.%d.%d", myIP[0], myIP[1], myIP[2], myIP[3]);
loggerNl(logBuf, LOGLEVEL_NOTICE);
#ifdef FTP_ENABLE
#ifdef SD_MMC_1BIT_MODE
ftpSrv.begin(SD_MMC, ftpUser, ftpPassword);
#else
ftpSrv.begin(ftpUser, ftpPassword);
#endif
#endif
} else { // Starts AP if WiFi-connect wasn't successful
accessPointStart((char *) FPSTR(accessPointNetworkSSID), apIP, apNetmask);
}
@ -3261,7 +3409,7 @@ void onWebsocketEvent(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsE
client->ping();
} else if (type == WS_EVT_DISCONNECT) {
//client disconnected
Serial.printf("ws[%s][%u] disconnect: %u\n", server->url(), client->id());
Serial.printf("ws[%s][%u] disconnect: %u\n", server->url(), uint(client->id()));
} else if (type == WS_EVT_ERROR) {
//error was received from the other end
Serial.printf("ws[%s][%u] error(%u): %s\n", server->url(), client->id(), *((uint16_t*)arg), (char*)data);
@ -3375,7 +3523,11 @@ void webserverStart(void) {
});
wServer.on("/files", HTTP_GET, [](AsyncWebServerRequest *request) {
#ifdef SD_MMC_1BIT_MODE
request->send(SD_MMC, DIRECTORY_INDEX_FILE, "application/json");
#else
request->send(SD, DIRECTORY_INDEX_FILE, "application/json");
#endif
});
wServer.onNotFound(notFound);
@ -3414,8 +3566,11 @@ void webserverStart(void) {
return NULL;
}
namespace_ID = FindNsID (nvs, _namespace) ; // Find ID of our namespace in NVS
#ifdef SD_MMC_1BIT_MODE
File backupFile = SD_MMC.open(_destFile, FILE_WRITE);
#else
File backupFile = SD.open(_destFile, FILE_WRITE);
#endif
if (!backupFile) {
return false;
}
@ -3536,13 +3691,17 @@ void setup() {
);
#endif
#ifndef SINGLE_SPI_ENABLE
#ifdef SD_MMC_1BIT_MODE
pinMode(2, INPUT_PULLUP);
#else
// Init uSD-SPI
pinMode(SPISD_CS, OUTPUT);
digitalWrite(SPISD_CS, HIGH);
#ifndef SINGLE_SPI_ENABLE
spiSD.begin(SPISD_SCK, SPISD_MISO, SPISD_MOSI, SPISD_CS);
spiSD.setFrequency(1000000);
#endif
#else
//SPI.begin(RFID_SCK, RFID_MISO, RFID_MOSI);
SPI.begin();
@ -3550,7 +3709,11 @@ void setup() {
#endif
#ifndef SINGLE_SPI_ENABLE
#ifdef SD_MMC_1BIT_MODE
while (!SD_MMC.begin("/sdcard", true)) {
#else
while (!SD.begin(SPISD_CS, spiSD)) {
#endif
#else
while (!SD.begin(SPISD_CS)) {
#endif
@ -3565,6 +3728,24 @@ void setup() {
}
// show SD card type
#ifdef SD_MMC_1BIT_MODE
Serial.println("SD card mounted in SD_MMC 1 Bit mode");
uint8_t cardType = SD_MMC.cardType();
#else
Serial.println("SD card mounted in SPI mode");
uint8_t cardType = SD.cardType();
#endif
if(cardType == CARD_MMC){
Serial.println("MMC");
} else if(cardType == CARD_SD){
Serial.println("SDSC");
} else if(cardType == CARD_SDHC){
Serial.println("SDHC");
} else {
Serial.println("UNKNOWN");
}
#ifdef HEADPHONE_ADJUST_ENABLE
pinMode(HP_DETECT, INPUT);
headphoneLastDetectionState = digitalRead(HP_DETECT);
@ -3847,10 +4028,17 @@ void setup() {
/**
* Create empty Index json file when no file exists.
*/
#ifdef SD_MMC_1BIT_MODE
if(!fileExists(SD_MMC,DIRECTORY_INDEX_FILE)){
createFile(SD_MMC,DIRECTORY_INDEX_FILE,"[]");
ESP.restart();
}
#else
if(!fileExists(SD,DIRECTORY_INDEX_FILE)){
createFile(SD,DIRECTORY_INDEX_FILE,"[]");
ESP.restart();
}
#endif
bootComplete = true;
Serial.print(F("Free heap: "));

29
src/settings.h

@ -1,7 +1,7 @@
#include "Arduino.h"
//########################## MODULES #################################
//#define MDNS_ENABLE // When enabled, you don't have to handle with Tonuino's IP-address. If hostname is set to "tonuino", you can reach it via tonuino.local
#define MDNS_ENABLE // When enabled, you don't have to handle with Tonuino's IP-address. If hostname is set to "tonuino", you can reach it via tonuino.local
#define MQTT_ENABLE // Make sure to configure mqtt-server and (optionally) username+pwd
#define FTP_ENABLE // Enables FTP-server
#define NEOPIXEL_ENABLE // Don't forget configuration of NUM_LEDS if enabled
@ -12,18 +12,33 @@
#define MEASURE_BATTERY_VOLTAGE // Enables battery-measurement via GPIO (ADC) and voltage-divider
//#define PLAY_LAST_RFID_AFTER_REBOOT // When restarting Tonuino, the last RFID that was active before, is recalled and played
//#define SINGLE_SPI_ENABLE // If only one SPI-instance should be used instead of two (not yet working!)
//#define BLUETOOTH_ENABLE // Doesn't work currently (so don't enable) as there's not enough DRAM available
//################## select SD card mode #############################
//#define SD_MMC_1BIT_MODE // run SD card in SD-MMC 1Bit mode
//#define SINGLE_SPI_ENABLE // If only one SPI-instance should be used instead of two (not yet working!)
//################## select RFID reader ##############################
#define RFID_READER_TYPE_MFRC522 // use MFRC522
//#define RFID_READER_TYPE_PN5180
//################## GPIO-configuration ##############################
// uSD-card-reader (via SPI)
#define SPISD_CS 15 // GPIO for chip select (SD)
#ifndef SINGLE_SPI_ENABLE
#ifdef SD_MMC_1BIT_MODE
// uSD-card-reader (via SD-MMC 1Bit)
//
// SD_MMC uses fixed pins
// MOSI 15
// SCKK 14
// MISO 2 // hardware pullup may required
#else
// uSD-card-reader (via SPI)
#define SPISD_CS 15 // GPIO for chip select (SD)
#ifndef SINGLE_SPI_ENABLE
#define SPISD_MOSI 13 // GPIO for master out slave in (SD) => not necessary for single-SPI
#define SPISD_MISO 16 // GPIO for master in slave ou (SD) => not necessary for single-SPI
#define SPISD_SCK 14 // GPIO for clock-signal (SD) => not necessary for single-SPI
#endif
#endif
// RFID (via SPI)
@ -33,6 +48,10 @@
#define RFID_MISO 19 // GPIO for master in slave out (RFID)
#define RFID_SCK 18 // GPIO for clock-signal (RFID)
#ifdef RFID_READER_TYPE_PN5180
#define RFID_BUSY 16 // PN5180 BUSY PIN
#define RFID_RST 22 // PN5180 RESET PIN
#endif
// I2S (DAC)
#define I2S_DOUT 25 // Digital out (I2S)
#define I2S_BCLK 27 // BCLK (I2S)

Loading…
Cancel
Save