mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-01 05:07:03 +08:00
chg: use bool instead
This commit is contained in:
parent
23f1a253a7
commit
9ebf3f4f6d
3 changed files with 20 additions and 18 deletions
|
@ -206,11 +206,11 @@ void ConstructEM410xEmulGraph(const char *uid,const uint8_t clock) {
|
|||
int i, j, binary[4], parity[4];
|
||||
uint32_t n;
|
||||
/* clear our graph */
|
||||
ClearGraph(0);
|
||||
ClearGraph(false);
|
||||
|
||||
/* write 9 start bits */
|
||||
for (i = 0; i < 9; i++)
|
||||
AppendGraph(0, clock, 1);
|
||||
AppendGraph(false, clock, 1);
|
||||
|
||||
/* for each hex char */
|
||||
parity[0] = parity[1] = parity[2] = parity[3] = 0;
|
||||
|
@ -221,13 +221,13 @@ void ConstructEM410xEmulGraph(const char *uid,const uint8_t clock) {
|
|||
binary[j] = n % 2;
|
||||
|
||||
/* append each bit */
|
||||
AppendGraph(0, clock, binary[0]);
|
||||
AppendGraph(0, clock, binary[1]);
|
||||
AppendGraph(0, clock, binary[2]);
|
||||
AppendGraph(0, clock, binary[3]);
|
||||
AppendGraph(false, clock, binary[0]);
|
||||
AppendGraph(false, clock, binary[1]);
|
||||
AppendGraph(false, clock, binary[2]);
|
||||
AppendGraph(false, clock, binary[3]);
|
||||
|
||||
/* append parity bit */
|
||||
AppendGraph(0, clock, binary[0] ^ binary[1] ^ binary[2] ^ binary[3]);
|
||||
AppendGraph(false, clock, binary[0] ^ binary[1] ^ binary[2] ^ binary[3]);
|
||||
|
||||
/* keep track of column parity */
|
||||
parity[0] ^= binary[0];
|
||||
|
@ -237,13 +237,13 @@ void ConstructEM410xEmulGraph(const char *uid,const uint8_t clock) {
|
|||
}
|
||||
|
||||
/* parity columns */
|
||||
AppendGraph(0, clock, parity[0]);
|
||||
AppendGraph(0, clock, parity[1]);
|
||||
AppendGraph(0, clock, parity[2]);
|
||||
AppendGraph(0, clock, parity[3]);
|
||||
AppendGraph(false, clock, parity[0]);
|
||||
AppendGraph(false, clock, parity[1]);
|
||||
AppendGraph(false, clock, parity[2]);
|
||||
AppendGraph(false, clock, parity[3]);
|
||||
|
||||
/* stop bit */
|
||||
AppendGraph(1, clock, 0);
|
||||
AppendGraph(true, clock, 0);
|
||||
}
|
||||
|
||||
//by marshmellow
|
||||
|
|
|
@ -13,8 +13,10 @@ int GraphBuffer[MAX_GRAPH_TRACE_LEN];
|
|||
int GraphTraceLen;
|
||||
int s_Buff[MAX_GRAPH_TRACE_LEN];
|
||||
|
||||
/* write a manchester bit to the graph */
|
||||
void AppendGraph(int redraw, int clock, int bit) {
|
||||
/* write a manchester bit to the graph
|
||||
TODO, verfy that this doesn't overflow buffer (iceman)
|
||||
*/
|
||||
void AppendGraph(bool redraw, int clock, int bit) {
|
||||
int i;
|
||||
//set first half the clock bit (all 1's or 0's for a 0 or 1 bit)
|
||||
for (i = 0; i < (int)(clock / 2); ++i)
|
||||
|
@ -28,7 +30,7 @@ void AppendGraph(int redraw, int clock, int bit) {
|
|||
}
|
||||
|
||||
// clear out our graph window
|
||||
int ClearGraph(int redraw) {
|
||||
int ClearGraph(bool redraw) {
|
||||
int gtl = GraphTraceLen;
|
||||
memset(GraphBuffer, 0x00, GraphTraceLen);
|
||||
GraphTraceLen = 0;
|
||||
|
@ -60,7 +62,7 @@ void save_restoreGB(uint8_t saveOpt) {
|
|||
void setGraphBuf(uint8_t *buf, size_t size) {
|
||||
if ( buf == NULL ) return;
|
||||
|
||||
ClearGraph(0);
|
||||
ClearGraph(false);
|
||||
|
||||
if ( size > MAX_GRAPH_TRACE_LEN )
|
||||
size = MAX_GRAPH_TRACE_LEN;
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
#include "lfdemod.h"
|
||||
#include "cmddata.h" //for g_debugmode
|
||||
|
||||
void AppendGraph(int redraw, int clock, int bit);
|
||||
int ClearGraph(int redraw);
|
||||
void AppendGraph(bool redraw, int clock, int bit);
|
||||
int ClearGraph(bool redraw);
|
||||
size_t getFromGraphBuf(uint8_t *buff);
|
||||
int GetAskClock(const char *str, bool printAns);
|
||||
int GetPskClock(const char *str, bool printAns);
|
||||
|
|
Loading…
Reference in a new issue