Skip to content

Commit

Permalink
add new app
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Jan 5, 2024
1 parent 7ce4cfe commit 0ed0713
Show file tree
Hide file tree
Showing 24 changed files with 2,725 additions and 0 deletions.
14 changes: 14 additions & 0 deletions non_catalog_apps/t5577_multiwriter/application.fam
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
App(
appid="t5577_multiwriter",
name="T5577 Multiwriter",
apptype=FlipperAppType.EXTERNAL,
targets=["f7"],
entry_point="t5577_multiwriter_app",
icon="A_125khz_14",
stack_size=2 * 1024,
order=20,
fap_description="Application for writing several keys to one t5577",
fap_version="0.1",
fap_icon="icon.png",
fap_category="RFID",
)
1,044 changes: 1,044 additions & 0 deletions non_catalog_apps/t5577_multiwriter/assets/assets_icons.c

Large diffs are not rendered by default.

235 changes: 235 additions & 0 deletions non_catalog_apps/t5577_multiwriter/assets/assets_icons.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
#pragma once

#include <gui/icon.h>

extern const Icon I_Certification1_103x56;
extern const Icon I_Certification2_46x33;
extern const Icon A_Levelup1_128x64;
extern const Icon A_Levelup2_128x64;
extern const Icon I_125_10px;
extern const Icon I_Apps_10px;
extern const Icon I_Nfc_10px;
extern const Icon I_back_10px;
extern const Icon I_badusb_10px;
extern const Icon I_dir_10px;
extern const Icon I_ibutt_10px;
extern const Icon I_ir_10px;
extern const Icon I_keyboard_10px;
extern const Icon I_loading_10px;
extern const Icon I_music_10px;
extern const Icon I_sub1_10px;
extern const Icon I_subrem_10px;
extern const Icon I_u2f_10px;
extern const Icon I_unknown_10px;
extern const Icon I_update_10px;
extern const Icon I_BLE_Pairing_128x64;
extern const Icon I_Ble_connected_15x15;
extern const Icon I_Ble_disconnected_15x15;
extern const Icon I_Button_18x18;
extern const Icon I_Circles_47x47;
extern const Icon I_Left_mouse_icon_9x9;
extern const Icon I_Ok_btn_9x9;
extern const Icon I_Ok_btn_pressed_13x13;
extern const Icon I_Pressed_Button_13x13;
extern const Icon I_Right_mouse_icon_9x9;
extern const Icon I_Space_65x18;
extern const Icon I_Voldwn_6x6;
extern const Icon I_Volup_8x6;
extern const Icon I_Clock_18x18;
extern const Icon I_Error_18x18;
extern const Icon I_EviSmile1_18x21;
extern const Icon I_EviSmile2_18x21;
extern const Icon I_EviWaiting1_18x21;
extern const Icon I_EviWaiting2_18x21;
extern const Icon I_Percent_10x14;
extern const Icon I_Smile_18x18;
extern const Icon I_UsbTree_48x22;
extern const Icon I_ActiveConnection_50x64;
extern const Icon I_ButtonCenter_7x7;
extern const Icon I_ButtonDown_7x4;
extern const Icon I_ButtonLeftSmall_3x5;
extern const Icon I_ButtonLeft_4x7;
extern const Icon I_ButtonRightSmall_3x5;
extern const Icon I_ButtonRight_4x7;
extern const Icon I_ButtonUp_7x4;
extern const Icon I_DFU_128x50;
extern const Icon I_Hashmark_7x7;
extern const Icon I_More_data_placeholder_5x7;
extern const Icon I_Warning_30x23;
extern const Icon I_arrow_nano_down;
extern const Icon I_arrow_nano_up;
extern const Icon A_Loading_24;
extern const Icon A_Round_loader_8x8;
extern const Icon I_DolphinDone_80x58;
extern const Icon I_DolphinMafia_119x62;
extern const Icon I_DolphinReadingSuccess_59x63;
extern const Icon I_DolphinSaved_92x58;
extern const Icon I_DolphinSuccess_91x55;
extern const Icon I_DolphinWait_61x59;
extern const Icon I_WarningDolphinFlip_45x42;
extern const Icon I_WarningDolphin_45x42;
extern const Icon I_Erase_pin_128x64;
extern const Icon I_ArrowUpEmpty_14x15;
extern const Icon I_ArrowUpFilled_14x15;
extern const Icon I_InfraredArrowDown_4x8;
extern const Icon I_InfraredArrowUp_4x8;
extern const Icon I_InfraredLearnShort_128x31;
extern const Icon I_celsius_24x23;
extern const Icon I_celsius_hover_24x23;
extern const Icon I_ch_down_24x21;
extern const Icon I_ch_down_hover_24x21;
extern const Icon I_ch_text_31x34;
extern const Icon I_ch_up_24x21;
extern const Icon I_ch_up_hover_24x21;
extern const Icon I_cool_30x51;
extern const Icon I_dry_19x20;
extern const Icon I_dry_hover_19x20;
extern const Icon I_dry_text_15x5;
extern const Icon I_fahren_24x23;
extern const Icon I_fahren_hover_24x23;
extern const Icon I_heat_30x51;
extern const Icon I_hourglass0_24x24;
extern const Icon I_hourglass1_24x24;
extern const Icon I_hourglass2_24x24;
extern const Icon I_hourglass3_24x24;
extern const Icon I_hourglass4_24x24;
extern const Icon I_hourglass5_24x24;
extern const Icon I_hourglass6_24x24;
extern const Icon I_max_24x23;
extern const Icon I_max_hover_24x23;
extern const Icon I_mode_19x20;
extern const Icon I_mode_hover_19x20;
extern const Icon I_mode_text_20x5;
extern const Icon I_mute_19x20;
extern const Icon I_mute_hover_19x20;
extern const Icon I_mute_text_19x5;
extern const Icon I_next_19x20;
extern const Icon I_next_hover_19x20;
extern const Icon I_next_text_19x6;
extern const Icon I_off_19x20;
extern const Icon I_off_hover_19x20;
extern const Icon I_off_text_12x5;
extern const Icon I_pause_19x20;
extern const Icon I_pause_hover_19x20;
extern const Icon I_pause_text_23x5;
extern const Icon I_play_19x20;
extern const Icon I_play_hover_19x20;
extern const Icon I_play_text_19x5;
extern const Icon I_power_19x20;
extern const Icon I_power_hover_19x20;
extern const Icon I_power_text_24x5;
extern const Icon I_prev_19x20;
extern const Icon I_prev_hover_19x20;
extern const Icon I_prev_text_19x5;
extern const Icon I_rotate_19x20;
extern const Icon I_rotate_hover_19x20;
extern const Icon I_rotate_text_24x5;
extern const Icon I_speed_text_30x30;
extern const Icon I_timer_19x20;
extern const Icon I_timer_hover_19x20;
extern const Icon I_timer_text_23x5;
extern const Icon I_vol_ac_text_30x30;
extern const Icon I_vol_tv_text_29x34;
extern const Icon I_voldown_24x21;
extern const Icon I_voldown_hover_24x21;
extern const Icon I_volup_24x21;
extern const Icon I_volup_hover_24x21;
extern const Icon I_DoorLeft_70x55;
extern const Icon I_DoorRight_70x55;
extern const Icon I_SmallArrowDown_3x5;
extern const Icon I_SmallArrowDown_4x7;
extern const Icon I_SmallArrowUp_3x5;
extern const Icon I_SmallArrowUp_4x7;
extern const Icon I_KeyBackspaceSelected_16x9;
extern const Icon I_KeyBackspace_16x9;
extern const Icon I_KeySaveSelected_24x11;
extern const Icon I_KeySave_24x11;
extern const Icon A_125khz_14;
extern const Icon A_BadUsb_14;
extern const Icon A_Clock_14;
extern const Icon A_Debug_14;
extern const Icon A_FileManager_14;
extern const Icon A_GPIO_14;
extern const Icon A_Infrared_14;
extern const Icon A_NFC_14;
extern const Icon A_Plugins_14;
extern const Icon A_Settings_14;
extern const Icon A_Sub1ghz_14;
extern const Icon A_SubGHzRemote_14;
extern const Icon A_U2F_14;
extern const Icon A_iButton_14;
extern const Icon I_ArrowC_1_36x36;
extern const Icon I_Detailed_chip_17x13;
extern const Icon I_Keychain_39x36;
extern const Icon I_Medium_chip_22x21;
extern const Icon I_Modern_reader_18x34;
extern const Icon I_Move_flipper_26x39;
extern const Icon I_NFC_dolphin_emulation_47x61;
extern const Icon I_NFC_manual_60x50;
extern const Icon I_Release_arrow_18x15;
extern const Icon I_check_big_20x17;
extern const Icon I_Pin_arrow_up_7x9;
extern const Icon I_Pin_attention_dpad_29x29;
extern const Icon I_Pin_back_arrow_10x8;
extern const Icon I_Pin_cell_13x13;
extern const Icon I_Pin_pointer_5x3;
extern const Icon I_Pin_star_7x7;
extern const Icon I_passport_bad1_46x49;
extern const Icon I_passport_bad2_46x49;
extern const Icon I_passport_bad3_46x49;
extern const Icon I_passport_bottom_128x18;
extern const Icon I_passport_happy1_46x49;
extern const Icon I_passport_happy2_46x49;
extern const Icon I_passport_happy3_46x49;
extern const Icon I_passport_left_6x46;
extern const Icon I_passport_okay1_46x49;
extern const Icon I_passport_okay2_46x49;
extern const Icon I_passport_okay3_46x49;
extern const Icon I_BatteryBody_52x28;
extern const Icon I_Battery_16x16;
extern const Icon I_FaceCharging_29x14;
extern const Icon I_FaceConfused_29x14;
extern const Icon I_FaceNopower_29x14;
extern const Icon I_FaceNormal_29x14;
extern const Icon I_Health_16x16;
extern const Icon I_Temperature_16x16;
extern const Icon I_Unplug_bg_bottom_128x10;
extern const Icon I_Unplug_bg_top_128x14;
extern const Icon I_Voltage_16x16;
extern const Icon I_RFIDDolphinReceive_97x61;
extern const Icon I_RFIDDolphinSend_97x61;
extern const Icon I_RFIDSmallChip_14x14;
extern const Icon I_SDQuestion_35x43;
extern const Icon I_Cry_dolph_55x52;
extern const Icon I_Alert_9x8;
extern const Icon I_Attention_5x8;
extern const Icon I_Background_128x11;
extern const Icon I_Battery_26x8;
extern const Icon I_Bluetooth_Connected_16x8;
extern const Icon I_Bluetooth_Idle_5x8;
extern const Icon I_Charging_lightning_9x10;
extern const Icon I_Charging_lightning_mask_9x10;
extern const Icon I_GameMode_11x8;
extern const Icon I_Hidden_window_9x8;
extern const Icon I_Muted_8x8;
extern const Icon I_Rpc_active_7x8;
extern const Icon I_SDcardFail_11x8;
extern const Icon I_SDcardMounted_11x8;
extern const Icon I_Cos_9x7;
extern const Icon I_Dynamic_9x7;
extern const Icon I_Fishing_123x52;
extern const Icon I_Lock_7x8;
extern const Icon I_MHz_25x11;
extern const Icon I_Quest_7x8;
extern const Icon I_Raw_9x7;
extern const Icon I_Scanning_123x52;
extern const Icon I_Static_9x7;
extern const Icon I_Unlock_7x8;
extern const Icon I_Auth_62x31;
extern const Icon I_Connect_me_62x31;
extern const Icon I_Connected_62x31;
extern const Icon I_Drive_112x35;
extern const Icon I_Error_62x31;
extern const Icon I_Updating_32x40;
extern const Icon I_iButtonDolphinVerySuccess_92x55;
extern const Icon I_iButtonKey_49x44;
143 changes: 143 additions & 0 deletions non_catalog_apps/t5577_multiwriter/helpers/t5577.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
#include "t5577.h"
#include <furi.h>
#include <furi_hal_rfid.h>
#include <stdint.h>

#define T5577_TIMING_WAIT_TIME 400
#define T5577_TIMING_START_GAP 30
#define T5577_TIMING_WRITE_GAP 18
#define T5577_TIMING_DATA_0 24
#define T5577_TIMING_DATA_1 56
#define T5577_TIMING_PROGRAM 700

#define T5577_OPCODE_PAGE_0 0b10
#define T5577_OPCODE_PAGE_1 0b11
#define T5577_OPCODE_RESET 0b00

static void t5577_start() {
furi_hal_rfid_tim_read_start(125000, 0.5);

// do not ground the antenna
furi_hal_rfid_pin_pull_release();
}

static void t5577_stop() {
furi_hal_rfid_tim_read_stop();
furi_hal_rfid_pins_reset();
}

static void t5577_write_gap(uint32_t gap_time) {
furi_hal_rfid_tim_read_pause();
furi_delay_us(gap_time * 8);
furi_hal_rfid_tim_read_continue();
}

static void t5577_write_bit(bool value) {
if(value) {
furi_delay_us(T5577_TIMING_DATA_1 * 8);
} else {
furi_delay_us(T5577_TIMING_DATA_0 * 8);
}
t5577_write_gap(T5577_TIMING_WRITE_GAP);
}

static void t5577_write_opcode(uint8_t value) {
t5577_write_bit((value >> 1) & 1);
t5577_write_bit((value >> 0) & 1);
}

static void t5577_write_reset() {
t5577_write_gap(T5577_TIMING_START_GAP);
t5577_write_bit(1);
t5577_write_bit(0);
}

static void t5577_write_block_pass(
uint8_t block,
bool lock_bit,
uint32_t data,
bool with_pass,
uint32_t password) {
furi_delay_us(T5577_TIMING_WAIT_TIME * 8);

// start gap
t5577_write_gap(T5577_TIMING_START_GAP);

// opcode for page 0
t5577_write_opcode(T5577_OPCODE_PAGE_0);

// password
if(with_pass) {
for(uint8_t i = 0; i < 32; i++) {
t5577_write_bit((password >> (31 - i)) & 1);
}
}

// lock bit
t5577_write_bit(lock_bit);

// data
for(uint8_t i = 0; i < 32; i++) {
t5577_write_bit((data >> (31 - i)) & 1);
}

// block address
t5577_write_bit((block >> 2) & 1);
t5577_write_bit((block >> 1) & 1);
t5577_write_bit((block >> 0) & 1);

furi_delay_us(T5577_TIMING_PROGRAM * 8);

furi_delay_us(T5577_TIMING_WAIT_TIME * 8);
t5577_write_reset();
}

static void t5577_write_block_simple(uint8_t block, bool lock_bit, uint32_t data) {
t5577_write_block_pass(block, lock_bit, data, false, 0);
}

void t5577_write(LFRFIDT5577Data* data) {
t5577_start();
FURI_CRITICAL_ENTER();
for(size_t i = 0; i < data->blocks_to_write; i++) {
t5577_write_block_simple(i, false, data->block[i]);
}
t5577_write_reset();
FURI_CRITICAL_EXIT();
t5577_stop();
}

void t5577_write_with_mask(LFRFIDT5577Data* data) {
t5577_start();
FURI_CRITICAL_ENTER();

uint8_t mask = data->mask;

for(size_t i = 0; i < data->blocks_to_write; i++) {
bool need_to_write = mask & 1;
mask >>= 1;
FURI_LOG_D(
"WRITIND",
"%08lX. i = %u. needtowrite: %u, mask: %u",
data->block[i],
i,
need_to_write,
mask);
if(!need_to_write) continue;
t5577_write_block_simple(i, false, data->block[i]);
}
t5577_write_reset();
FURI_CRITICAL_EXIT();
t5577_stop();
}

void t5577_write_with_pass(LFRFIDT5577Data* data, uint32_t password) {
t5577_start();
FURI_CRITICAL_ENTER();
for(size_t i = 0; i < data->blocks_to_write; i++) {
t5577_write_block_pass(i, false, data->block[i], true, password);
}
t5577_write_reset();
FURI_CRITICAL_EXIT();
t5577_stop();
}
Loading

0 comments on commit 0ed0713

Please sign in to comment.