update rfid code and CR95 lib
This commit is contained in:
Submodule FW/leo_muziekdoos_esp32/lib/rfid_C95HF updated: 2745677ab7...4463b521e8
@@ -18,5 +18,7 @@ lib_deps =
|
||||
monitor_speed = 115200
|
||||
lib_ldf_mode = deep+
|
||||
extra_scripts = ./littlefsbuilder.py
|
||||
build_flags =
|
||||
-DHARDWARE=1
|
||||
;upload_protocol = espota
|
||||
;upload_port = 192.168.2.254
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#define HARDWARE 1
|
||||
|
||||
|
||||
#if HARDWARE == 2
|
||||
#define I2S_BCLK 19
|
||||
#define I2S_WCLK 21
|
||||
#define I2S_DATA 18
|
||||
@@ -19,3 +22,26 @@
|
||||
#define MEAS_ADC 35 //ADC1_CH7
|
||||
|
||||
#define HALL_INPUT 36 //ADC1_CH0
|
||||
#endif
|
||||
|
||||
#if HARDWARE == 1
|
||||
#define I2S_BCLK 21
|
||||
#define I2S_WCLK 13
|
||||
#define I2S_DATA 14
|
||||
#define DAC_SDMODE 27
|
||||
|
||||
#define NFC_SS 25
|
||||
#define NFC_SCK 18
|
||||
#define NFC_MOSI 23
|
||||
#define NFC_MISO 19
|
||||
#define NFC_RST 22 //not connectedx
|
||||
#define NFC_IRQ 26
|
||||
|
||||
#define PWR_HOLD 4
|
||||
#define PWR_BTN 9
|
||||
#define MEAS_EN 10
|
||||
#define MEAS_ADC 35 //ADC1_CH7
|
||||
|
||||
#define HALL_INPUT 36 //ADC1_CH0
|
||||
|
||||
#endif
|
||||
@@ -9,8 +9,6 @@
|
||||
#include "ota.h"
|
||||
#include "game.h"
|
||||
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
//initPower();
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
#include "rfid.h"
|
||||
|
||||
// uint8_t cardsToCheck[] = {TRACK_NFCTYPE1,
|
||||
// TRACK_NFCTYPE2,
|
||||
// TRACK_NFCTYPE3,
|
||||
// TRACK_NFCTYPE4A,
|
||||
// TRACK_NFCTYPE4B,
|
||||
// TRACK_NFCTYPE5};
|
||||
uint8_t cardsToCheck[] = {TRACK_NFCTYPE1,
|
||||
TRACK_NFCTYPE2,
|
||||
TRACK_NFCTYPE3,
|
||||
TRACK_NFCTYPE4A,
|
||||
TRACK_NFCTYPE4B,
|
||||
TRACK_NFCTYPE5};
|
||||
|
||||
// uint8_t currentCardIdx = 0;
|
||||
// uint8_t maxCardIdx = sizeof(cardsToCheck);
|
||||
uint8_t currentCardIdx = 0;
|
||||
uint8_t maxCardIdx = sizeof(cardsToCheck);
|
||||
|
||||
uint32_t last_rfid_update = 0;
|
||||
CR95HF reader(NFC_SS, NFC_SCK, NFC_MOSI, NFC_MISO, NFC_IRQ);
|
||||
//CR95HF reader(NFC_SS, NFC_SCK, NFC_MOSI, NFC_MISO, NFC_IRQ);
|
||||
|
||||
//*****************************************************************************************//
|
||||
void initRfid()
|
||||
@@ -19,8 +19,8 @@ void initRfid()
|
||||
Serial.println(F("rfid init")); //shows in serial that it is ready to read
|
||||
|
||||
//int8_t sck=-1, int8_t miso=-1, int8_t mosi=-1, int8_t ss=-1);
|
||||
//ConfigManager_HWInit(NFC_SCK, NFC_MISO, NFC_MOSI, NFC_SS, NFC_IRQ);
|
||||
reader.begin();
|
||||
ConfigManager_HWInit(NFC_SCK, NFC_MISO, NFC_MOSI, NFC_SS, NFC_IRQ);
|
||||
//reader.begin();
|
||||
Serial.println(F("rfid init done")); //shows in serial that it is ready to read
|
||||
}
|
||||
|
||||
@@ -31,12 +31,13 @@ void handleRfid()
|
||||
|
||||
if (timeNow - last_rfid_update > RFIDINTERVAL)
|
||||
{
|
||||
|
||||
String id = reader.getID();
|
||||
if (id != "")
|
||||
Serial.printf("rfid: reading card type index %d\n",currentCardIdx);
|
||||
uint8_t TagType = ConfigManager_TagHunting(cardsToCheck[currentCardIdx++]);
|
||||
if(currentCardIdx > maxCardIdx)
|
||||
{
|
||||
Serial.println(id);
|
||||
currentCardIdx = 0;
|
||||
}
|
||||
Serial.printf("rfid: read card returned %d\n",TagType);
|
||||
last_rfid_update = timeNow;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,19 @@
|
||||
#include "board.h"
|
||||
#include "Arduino.h"
|
||||
#include "SerialDebug.h"
|
||||
#include "lib_NDEF_URI.h"
|
||||
#include "lib_NDEF_SMS.h"
|
||||
#include "lib_NDEF_Text.h"
|
||||
#include "lib_NDEF_Email.h"
|
||||
#include "lib_NDEF_Geo.h"
|
||||
#include "lib_95HFConfigManager.h"
|
||||
#include "miscellaneous.h"
|
||||
#include "lib_95HFConfigManager.h"
|
||||
#include "lib_wrapper.h"
|
||||
#include "lib_NDEF_URI.h"
|
||||
#include "drv_spi.h"
|
||||
|
||||
// #include <SPI.h>
|
||||
// #include "lib_95HFConfigManager.h"
|
||||
// #include "drv_spi.h"
|
||||
// #include "lib_wrapper.h"
|
||||
// #include "miscellaneous.h"
|
||||
|
||||
#include "CR95HF.h"
|
||||
//#include "CR95HF.h"
|
||||
|
||||
#define RFIDINTERVAL 200
|
||||
|
||||
|
||||
Reference in New Issue
Block a user