working rfid on hwv2, latest arduino-esp
This commit is contained in:
Submodule FW/leo_muziekdoos_esp32/lib/ESP8266Audio updated: 179bba0829...cd47e00a7d
Submodule FW/leo_muziekdoos_esp32/lib/PN532 updated: ae7421a5b3...47ec860298
@@ -9,7 +9,7 @@
|
|||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[env:esp32-pico]
|
[env:esp32-pico]
|
||||||
platform = espressif32
|
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
|
||||||
board = m5stack-atom
|
board = m5stack-atom
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
@@ -19,6 +19,6 @@ monitor_speed = 115200
|
|||||||
lib_ldf_mode = deep+
|
lib_ldf_mode = deep+
|
||||||
extra_scripts = ./littlefsbuilder.py
|
extra_scripts = ./littlefsbuilder.py
|
||||||
build_flags =
|
build_flags =
|
||||||
-DHARDWARE=1
|
-DHARDWARE=2
|
||||||
;upload_protocol = espota
|
;upload_protocol = espota
|
||||||
;upload_port = 192.168.2.254
|
;upload_port = 192.168.2.254
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define HARDWARE 1
|
#ifndef HARDWARE
|
||||||
|
#define HARDWARE 2
|
||||||
|
#endif
|
||||||
|
|
||||||
#if HARDWARE == 2
|
#if HARDWARE == 2
|
||||||
#define I2S_BCLK 19
|
#define I2S_BCLK 19
|
||||||
@@ -9,16 +10,15 @@
|
|||||||
#define I2S_DATA 18
|
#define I2S_DATA 18
|
||||||
#define DAC_SDMODE 23
|
#define DAC_SDMODE 23
|
||||||
|
|
||||||
#define NFC_SS 27
|
#define NFC_SS 25
|
||||||
#define NFC_SCK 25
|
#define NFC_SCK 14
|
||||||
#define NFC_MOSI 26
|
#define NFC_MOSI 26
|
||||||
#define NFC_MISO 14
|
#define NFC_MISO 27
|
||||||
//#define NFC_RST 22 //not connectedx
|
|
||||||
#define NFC_IRQ 13
|
#define NFC_IRQ 13
|
||||||
|
|
||||||
#define PWR_HOLD 4
|
#define PWR_HOLD 4
|
||||||
#define PWR_BTN 9
|
#define PWR_BTN 5
|
||||||
#define MEAS_EN 10
|
#define MEAS_EN 12
|
||||||
#define MEAS_ADC 35 //ADC1_CH7
|
#define MEAS_ADC 35 //ADC1_CH7
|
||||||
|
|
||||||
#define HALL_INPUT 36 //ADC1_CH0
|
#define HALL_INPUT 36 //ADC1_CH0
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
//initPower();
|
initPower();
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
delay(2000);
|
delay(2000);
|
||||||
|
|
||||||
@@ -30,8 +30,8 @@ void loop()
|
|||||||
debugHandle();
|
debugHandle();
|
||||||
|
|
||||||
handleAudio();
|
handleAudio();
|
||||||
handleRfid();
|
//handleRfid();
|
||||||
//handleGame();
|
//handleGame();
|
||||||
//handlePower();
|
handlePower();
|
||||||
//handleOta();
|
//handleOta();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,31 @@
|
|||||||
#include "rfid.h"
|
#include "rfid.h"
|
||||||
|
|
||||||
|
|
||||||
PN532_SPI pn532spi(SPI, NFC_SS, NFC_SCK, NFC_MISO, NFC_MOSI);
|
PN532_SPI pn532spi(SPI, NFC_SS, NFC_SCK, NFC_MISO, NFC_MOSI);
|
||||||
NfcAdapter nfc = NfcAdapter(pn532spi);
|
NfcAdapter nfc = NfcAdapter(pn532spi);
|
||||||
|
|
||||||
|
uint32_t lastRFID = 0;
|
||||||
|
|
||||||
//*****************************************************************************************//
|
//*****************************************************************************************//
|
||||||
void initRfid()
|
void initRfid()
|
||||||
{
|
{
|
||||||
//int8_t sck=-1, int8_t miso=-1, int8_t mosi=-1, int8_t ss=-1);
|
// int8_t sck=-1, int8_t miso=-1, int8_t mosi=-1, int8_t ss=-1);
|
||||||
nfc.begin(true);
|
nfc.begin(true);
|
||||||
Serial.println(F("rfid init done")); //shows in serial that it is ready to read
|
Serial.println(F("rfid init done")); // shows in serial that it is ready to read
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************************//
|
//*****************************************************************************************//
|
||||||
void handleRfid()
|
void handleRfid()
|
||||||
{
|
{
|
||||||
if (nfc.tagPresent())
|
uint32_t timeNow = millis();
|
||||||
|
if (lastRFID - timeNow > RFIDINTERVAL)
|
||||||
{
|
{
|
||||||
NfcTag tag = nfc.read();
|
|
||||||
String uid = tag.getUidString();
|
if (nfc.tagPresent())
|
||||||
Serial.println(uid);
|
{
|
||||||
|
NfcTag tag = nfc.read();
|
||||||
|
String uid = tag.getUidString();
|
||||||
|
Serial.println(uid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//*****************************************************************************************//
|
//*****************************************************************************************//
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "NfcAdapter.h"
|
#include "NfcAdapter.h"
|
||||||
|
|
||||||
#define NDEF_SUPPORT_MIFARE_CLASSIC
|
#define NDEF_SUPPORT_MIFARE_CLASSIC
|
||||||
|
#define RFIDINTERVAL 200
|
||||||
|
|
||||||
void initRfid(void);
|
void initRfid(void);
|
||||||
void handleRfid(void);
|
void handleRfid(void);
|
||||||
Reference in New Issue
Block a user