lfrfid: clear_t5577: major code cleanup

This commit is contained in:
TQMatvey 2022-12-21 15:00:52 +07:00
parent 060a48cdfc
commit 6d8ecec051
3 changed files with 2 additions and 22 deletions

View File

@ -31,12 +31,6 @@ void write_bit(T55xxTiming* t55xxtiming, bool value) {
write_gap(t55xxtiming->write_gap);
}
void write_byte(T55xxTiming* t55xxtiming, uint8_t value) {
for(uint8_t i = 0; i < 8; i++) {
write_bit(t55xxtiming, (value >> i) & 1);
}
}
void write_block(
T55xxTiming* t55xxtiming,
uint8_t page,

View File

@ -10,18 +10,10 @@ typedef struct {
uint16_t program;
} T55xxTiming;
typedef struct {
uint8_t opcode_page_0;
uint8_t opcode_page_1;
uint8_t opcode_reset;
} T55xxCmd;
//static void writer_initialize(T55xxTiming* t55xxtiming, T55xxCmd* t55xxcmd);
void writer_start();
void writer_stop();
void write_gap(uint32_t gap_time);
void write_bit(T55xxTiming* t55xxtiming, bool value);
void write_byte(T55xxTiming* t55xxtiming, uint8_t value);
void write_block(
T55xxTiming* t55xxtiming,
uint8_t page,

View File

@ -1,11 +1,7 @@
#include "../lfrfid_i.h"
#include "../helpers/rfid_writer.h"
static void writer_initialize(T55xxTiming* t55xxtiming, T55xxCmd* t55xxcmd) {
t55xxcmd->opcode_page_0 = 0b10;
t55xxcmd->opcode_page_1 = 0b11;
t55xxcmd->opcode_reset = 0b00;
static void writer_initialize(T55xxTiming* t55xxtiming) {
t55xxtiming->wait_time = 400;
t55xxtiming->start_gap = 30;
t55xxtiming->write_gap = 18;
@ -16,7 +12,6 @@ static void writer_initialize(T55xxTiming* t55xxtiming, T55xxCmd* t55xxcmd) {
static void lfrfid_clear_t5577_password_and_config_to_EM(LfRfid* app) {
T55xxTiming* t55xxtiming = malloc(sizeof(T55xxTiming));
T55xxCmd* t55xxcmd = malloc(sizeof(T55xxCmd));
Popup* popup = app->popup;
char curr_buf[32] = {};
//TODO: use .txt file in resourses for passwords.
@ -43,7 +38,7 @@ static void lfrfid_clear_t5577_password_and_config_to_EM(LfRfid* app) {
const uint32_t em_config_block_data =
0b00000000000101001000000001000000; //no pwd&aor config block
writer_initialize(t55xxtiming, t55xxcmd);
writer_initialize(t55xxtiming);
popup_set_header(popup, "Removing\npassword", 90, 36, AlignCenter, AlignCenter);
popup_set_icon(popup, 0, 3, &I_RFIDDolphinSend_97x61);
@ -70,7 +65,6 @@ static void lfrfid_clear_t5577_password_and_config_to_EM(LfRfid* app) {
notification_message(app->notifications, &sequence_blink_stop);
popup_reset(app->popup);
free(t55xxtiming);
free(t55xxcmd);
}
void lfrfid_scene_clear_t5577_on_enter(void* context) {