Преглед на файлове

Quick HF tests, initial mag_device commit

Zachary Weiss преди 3 години
родител
ревизия
9d92e652b8
променени са 6 файла, в които са добавени 34 реда и са изтрити 2 реда
  1. 2 1
      README.md
  2. 1 1
      application.fam
  3. 0 0
      icons/mag_10px.png
  4. 7 0
      mag_device.c
  5. 8 0
      mag_device.h
  6. 16 0
      scenes/mag_scene_emulate_test.c

+ 2 - 1
README.md

@@ -21,4 +21,5 @@ Other misc things to investigate / build:
 
 
 HF coil notes:
-NFC reader field can be turned on / off with `furi_hal_nfc_field_on();` and `furi_hal_nfc_field_off();` respectively, as seen in nfc_scene_field.c (used for debug purposes). At a lower level, that consists of `furi_hal_nfc_exit_sleep();` and `st25r3916TxRxOn();` to turn on, and `st25r3916TxRxOff();` and `furi_hal_nfc_start_sleep();` to turn off. May be worth trying directly (wake from sleep at setup, toggle on and off corresponding with bit direction, send to sleep on exit). If this doesn't work, will likely need to consider lower-level control.
+NFC reader field can be turned on / off with `furi_hal_nfc_field_on();` and `furi_hal_nfc_field_off();` respectively, as seen in nfc_scene_field.c (used for debug purposes). Initial tests with `furi_hal_nfc_field_on();` are promising signal-wise, but the delay introduced by the wake/sleep initialization renders it impossible to toggle rapidly. At a lower level, that consists of `furi_hal_nfc_exit_sleep();` and `st25r3916TxRxOn();` to turn on, and `st25r3916TxRxOff();` and `furi_hal_nfc_start_sleep();` to turn off. May be worth trying directly (wake from sleep at setup, toggle on and off corresponding with bit direction, send to sleep on exit). Initial tests have been difficult to get work as some of the st25r3916 symbols are unresolved; need to figure out how to import and call it properly, or how to get another layer lower of control. 
+

+ 1 - 1
application.fam

@@ -15,5 +15,5 @@ App(
     order=20,
     fap_icon="mag_10px.png",
     fap_category="Tools",
-    fap_icon_assets="imgs",
+    fap_icon_assets="icons",
 )

+ 0 - 0
imgs/mag_10px.png → icons/mag_10px.png


+ 7 - 0
mag_device.c

@@ -0,0 +1,7 @@
+#include "mag_device.h"
+
+#include <toolbox/path.h>
+#include <flipper_format/flipper_format.h>
+
+//static const char* mag_file_header = "Flipper Mag device";
+//static const uint32_t mag_file_version = 1;

+ 8 - 0
mag_device.h

@@ -0,0 +1,8 @@
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <storage/storage.h>
+#include <dialogs/dialogs.h>
+
+#include "mag_icons.h"

+ 16 - 0
scenes/mag_scene_emulate_test.c

@@ -28,10 +28,17 @@ static void play_bit(uint8_t send_bit) {
     gpio_item_set_rfid_pin(PIN_B, !magspoof_bit_dir);
     furi_delay_us(CLOCK_US);
 
+    // NFC tests
+    //(magspoof_bit_dir) ? st25r3916TxRxOn() : st25r3916TxRxOff();
+    //(magspoof_bit_dir) ? furi_hal_nfc_field_on() : furi_hal_nfc_field_off();
+    
     if (send_bit) {
         magspoof_bit_dir ^= 1;
         gpio_item_set_rfid_pin(PIN_A, magspoof_bit_dir);
         gpio_item_set_rfid_pin(PIN_B, !magspoof_bit_dir);
+
+        //(magspoof_bit_dir) ? st25r3916TxRxOn() : st25r3916TxRxOff();
+        //(magspoof_bit_dir) ? furi_hal_nfc_field_on() : furi_hal_nfc_field_off();
     }
     furi_delay_us(CLOCK_US);
 }
@@ -65,6 +72,9 @@ static void mag_spoof(FuriString *track_str, uint8_t track) {
     furi_hal_ibutton_start_drive();
     furi_hal_ibutton_pin_low();
 
+    // NFC TEST
+    furi_hal_nfc_exit_sleep();
+
     // Initializing at GpioSpeedLow seems sufficient for our needs; no improvements seen by increasing speed setting
 
     // this doesn't seem to make a difference, leaving it in
@@ -129,10 +139,16 @@ static void mag_spoof(FuriString *track_str, uint8_t track) {
 
     gpio_item_set_rfid_pin(PIN_A, 0);
     gpio_item_set_rfid_pin(PIN_B, 0);
+    // NFC TEST
+    //st25r3916TxRxOff();
+    //furi_hal_nfc_field_off();
 
     // end critical timing section
     FURI_CRITICAL_EXIT();
 
+    // NFC TEST
+    //furi_hal_nfc_start_sleep();
+
     furi_hal_rfid_pins_reset();
     furi_hal_power_disable_otg();
 }