feat added rfid, disabled auto play

This commit is contained in:
2021-10-01 15:12:25 +02:00
parent d1772527b4
commit 51e06b5eba
7 changed files with 22 additions and 48 deletions

View File

@@ -8,13 +8,12 @@
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:m5stack-core2]
[env:esp32-pico]
platform = espressif32
board = m5stack-atom
framework = arduino
lib_deps =
;http://192.168.2.3/Bonobo.Git.Server/ESP8266Audio.git
;http://192.168.2.3/Bonobo.Git.Server/LittleFS_esp32.git
;using git submodules
monitor_speed = 115200
lib_ldf_mode = deep+

View File

@@ -72,7 +72,7 @@ void initAudio()
mp3 = new AudioGeneratorMP3();
mp3->RegisterStatusCB(StatusCallback, (void *)"mp3");
Serial.println("init Audio Done");
playSong(i);
//playSong(i);
}
void handleAudio()
@@ -87,7 +87,7 @@ void handleAudio()
i++;
n= 0;
}
playSong(i);
//playSong(i);
;
}
}

View File

@@ -1,6 +1,12 @@
#pragma once
#define I2S_BCLK 19
#define I2S_WCLK 33
#define I2S_DATA 22
#define I2S_BCLK 21
#define I2S_WCLK 13
#define I2S_DATA 14
#define DAC_SDMODE
#define NFC_SS 25
#define NFC_SCK 18
#define NFC_MOSI 23
#define NFC_MISO 19

View File

@@ -3,6 +3,7 @@
#include "storage.h"
#include "audio.h"
#include "rfid.h"
void setup()
@@ -12,9 +13,11 @@ void setup()
initStorage();
initAudio();
initRfid();
}
void loop()
{
handleAudio();
handleRfid();
}

View File

@@ -1,43 +1,5 @@
#include "rfid.h"
// void initRfid(void)
// {
// }
// void handleRfid(void)
// {
// }
/*
* Initial Author: ryand1011 (https://github.com/ryand1011)
*
* Reads data written by a program such as "rfid_write_personal_data.ino"
*
* See: https://github.com/miguelbalboa/rfid/tree/master/examples/rfid_write_personal_data
*
* Uses MIFARE RFID card using RFID-RC522 reader
* Uses MFRC522 - Library
* -----------------------------------------------------------------------------------------
* MFRC522 Arduino Arduino Arduino Arduino Arduino
* Reader/PCD Uno/101 Mega Nano v3 Leonardo/Micro Pro Micro
* Signal Pin Pin Pin Pin Pin Pin
* -----------------------------------------------------------------------------------------
* RST/Reset RST 9 5 D9 RESET/ICSP-5 RST
* SPI SS SDA(SS) 10 53 D10 10 10
* SPI MOSI MOSI 11 / ICSP-4 51 D11 ICSP-4 16
* SPI MISO MISO 12 / ICSP-1 50 D12 ICSP-1 14
* SPI SCK SCK 13 / ICSP-3 52 D13 ICSP-3 15
*
* More pin layouts for other boards can be found here: https://github.com/miguelbalboa/rfid#pin-layout
*/
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 9 // Configurable, see typical pin layout above
#define SS_PIN 10 // Configurable, see typical pin layout above
@@ -45,8 +7,9 @@ MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
//*****************************************************************************************//
void initRfid() {
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522 card
//int8_t sck=-1, int8_t miso=-1, int8_t mosi=-1, int8_t ss=-1);
SPI.begin(NFC_SCK,NFC_MISO,NFC_MOSI,NFC_SS ); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522 card
Serial.println(F("Read personal data on a MIFARE PICC:")); //shows in serial that it is ready to read
}

View File

@@ -1,5 +1,8 @@
#pragma once
#include "board.h"
#include <SPI.h>
#include <MFRC522.h>
void initRfid(void);