10 /* low-level hardware control */
12 static int CmdHelp(const char *Cmd
);
14 int CmdDetectReader(const char *Cmd
)
16 UsbCommand c
={CMD_LISTEN_READER_FIELD
};
17 // 'l' means LF - 125/134 kHz
20 } else if (*Cmd
== 'h') {
22 } else if (*Cmd
!= '\0') {
23 PrintAndLog("use 'detectreader' or 'detectreader l' or 'detectreader h'");
31 int CmdFPGAOff(const char *Cmd
)
33 UsbCommand c
= {CMD_FPGA_MAJOR_MODE_OFF
};
38 int CmdLCD(const char *Cmd
)
42 UsbCommand c
={CMD_LCD
};
43 sscanf(Cmd
, "%x %d", &i
, &j
);
51 int CmdLCDReset(const char *Cmd
)
53 UsbCommand c
= {CMD_LCD_RESET
, {strtol(Cmd
, NULL
, 0), 0, 0}};
58 int CmdReadmem(const char *Cmd
)
60 UsbCommand c
= {CMD_READ_MEM
, {strtol(Cmd
, NULL
, 0), 0, 0}};
65 int CmdReset(const char *Cmd
)
67 UsbCommand c
= {CMD_HARDWARE_RESET
};
73 * Sets the divisor for LF frequency clock: lets the user choose any LF frequency below
76 int CmdSetDivisor(const char *Cmd
)
78 UsbCommand c
= {CMD_SET_LF_DIVISOR
, {strtol(Cmd
, NULL
, 0), 0, 0}};
79 if (c
.arg
[0] < 0 || c
.arg
[0] > 255) {
80 PrintAndLog("divisor must be between 19 and 255");
83 PrintAndLog("Divisor set, expected freq=%dHz", 12000000 / (c
.arg
[0]+1));
88 int CmdSetMux(const char *Cmd
)
90 UsbCommand c
={CMD_SET_ADC_MUX
};
91 if (strcmp(Cmd
, "lopkd") == 0) {
93 } else if (strcmp(Cmd
, "loraw") == 0) {
95 } else if (strcmp(Cmd
, "hipkd") == 0) {
97 } else if (strcmp(Cmd
, "hiraw") == 0) {
104 int CmdTune(const char *Cmd
)
106 UsbCommand c
= {CMD_MEASURE_ANTENNA_TUNING
};
111 int CmdVersion(const char *Cmd
)
113 UsbCommand c
= {CMD_VERSION
};
118 static command_t CommandTable
[] =
120 {"help", CmdHelp
, 1, "This help"},
121 {"detectreader", CmdDetectReader
,0, "['l'|'h'] -- Detect external reader field (option 'l' or 'h' to limit to LF or HF)"},
122 {"fpgaoff", CmdFPGAOff
, 0, "Set FPGA off"},
123 {"lcd", CmdLCD
, 0, "<HEX command> <count> -- Send command/data to LCD"},
124 {"lcdreset", CmdLCDReset
, 0, "Hardware reset LCD"},
125 {"readmem", CmdReadmem
, 0, "[address] -- Read memory at decimal address from flash"},
126 {"reset", CmdReset
, 0, "Reset the Proxmark3"},
127 {"setlfdivisor", CmdSetDivisor
, 0, "<19 - 255> -- Drive LF antenna at 12Mhz/(divisor+1)"},
128 {"setmux", CmdSetMux
, 0, "<loraw|hiraw|lopkd|hipkd> -- Set the ADC mux to a specific value"},
129 {"tune", CmdTune
, 0, "Measure antenna tuning"},
130 {"version", CmdVersion
, 0, "Show version inforation about the connected Proxmark"},
131 {NULL
, NULL
, 0, NULL
}
134 int CmdHW(const char *Cmd
)
136 CmdsParse(CommandTable
, Cmd
);
140 int CmdHelp(const char *Cmd
)
142 CmdsHelp(CommandTable
);