Skip to content

Commit

Permalink
Use capibaraZero's fork of Adafruit-PN532
Browse files Browse the repository at this point in the history
Avoid PN532 hangs after polling stop without losing FeliCa and ATQA/SAK feature
  • Loading branch information
andreock committed Dec 28, 2024
1 parent 5790c84 commit 89d5c36
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 19 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ jobs:
python-version: '3.12'
- name: Install PlatformIO Core
run: pip install --upgrade platformio
- name: Prepare PN532 libraries
run: bash init_nfc_libs.sh
- name: Prepare release folder
run: mkdir release
- name: Build ESP32-S3-DevKitC
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
# VSCode Cmake stuff
build

# Seeed-Studio libs
lib/PN532
lib/PN532_I2C

# MacOS useless file
.DS_Store

Expand Down
2 changes: 2 additions & 0 deletions include/boards/arduino_nano_esp32/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
// PN532(NFC)
#define PN532_SCL A6
#define PN532_SDA A7
#define PN532_RST -1
#define PN532_IRQ -1

#define BATTERY_MONITOR A0

Expand Down
2 changes: 2 additions & 0 deletions include/boards/esp32_s3_devkitc/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@

#define PN532_SDA 8
#define PN532_SCL 9
#define PN532_RST -1
#define PN532_IRQ -1

#define BATTERY_MONITOR 2

Expand Down
4 changes: 2 additions & 2 deletions include/boards/lilygo_t_embed_cc1101/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
// PN532(NFC)
#define NFC_BUS_SCL 18
#define NFC_BUS_SDA 8
#define NFC_RST 45
#define NFC_IRQ 17
#define PN532_RST 45
#define PN532_IRQ 17

#define BOARD_PWR_EN 15
#define BQ27220_BATTERY
Expand Down
6 changes: 0 additions & 6 deletions init_nfc_libs.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ class Peripherals_Lilygo_t_embed_cc1101 : public Peripherals {
digitalWrite(BOARD_PWR_EN, HIGH); // Power on CC1101 an

// NFC
pinMode(NFC_RST, OUTPUT);
digitalWrite(NFC_RST, HIGH);
pinMode(NFC_IRQ, OPEN_DRAIN);
pinMode(PN532_RST, OUTPUT);
digitalWrite(PN532_RST, HIGH);
pinMode(PN532_IRQ, OPEN_DRAIN);
};
void init_sd() {
common_init_sd(SD_CARD_SCK, SD_CARD_MISO, SD_CARD_MOSI, SD_CARD_CS);
Expand Down
5 changes: 3 additions & 2 deletions lib/nfc_attacks/nfc_attacks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef NFC_ATTACKS_H
#define NFC_ATTACKS_H
#include <stdint.h>

#include "../../include/pins.h"
typedef struct SectorResult {
uint8_t uid[7];
uint8_t uid_len = 0;
Expand All @@ -34,7 +34,7 @@ typedef struct SectorResult {

class NFCAttacks {
private:
NFCFramework nfc_framework = NFCFramework();
NFCFramework nfc_framework = NFCFramework(PN532_IRQ, PN532_RST);
bool is_there_null_blocks(NFCTag *tag);
NFCTag *current_tag = (NFCTag *)malloc(sizeof(NFCTag));
uint8_t tried_keys = 0;
Expand All @@ -49,6 +49,7 @@ class NFCAttacks {
public:
NFCAttacks(/* args */);
~NFCAttacks() {};
bool begin();
void power_down() {nfc_framework.power_down();};
bool bruteforce();
void read_uid(uint8_t *uid, uint8_t *uid_length);
Expand Down

0 comments on commit 89d5c36

Please sign in to comment.