mirror of
https://github.com/RfidResearchGroup/ChameleonMini.git
synced 2026-05-12 11:20:37 -07:00
Merge branch 'master' of https://github.com/robots/ChameleonMini
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -29,7 +29,8 @@ typedef enum {
|
||||
Reader14443_Get_UID,
|
||||
Reader14443_Autocalibrate,
|
||||
Reader14443_Read_MF_Ultralight,
|
||||
Reader14443_Identify
|
||||
Reader14443_Identify,
|
||||
Reader14443_Identify_Clone
|
||||
} Reader14443Command;
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Settings.h"
|
||||
#include "Memory.h"
|
||||
#include "Map.h"
|
||||
#include "Terminal/CommandLine.h"
|
||||
#include "Application/Application.h"
|
||||
|
||||
#define BUTTON_PORT PORTA
|
||||
@@ -27,6 +28,7 @@ static const MapEntryType PROGMEM ButtonActionMap[] = {
|
||||
{ .Id = BUTTON_ACTION_RECALL_MEM, .Text = "RECALL_MEM" },
|
||||
{ .Id = BUTTON_ACTION_TOGGLE_FIELD, .Text = "TOGGLE_FIELD" },
|
||||
{ .Id = BUTTON_ACTION_STORE_LOG, .Text = "STORE_LOG" },
|
||||
{ .Id = BUTTON_ACTION_CLONE, .Text = "CLONE" },
|
||||
};
|
||||
|
||||
static void ExecuteButtonAction(ButtonActionEnum ButtonAction)
|
||||
@@ -180,6 +182,11 @@ static void ExecuteButtonAction(ButtonActionEnum ButtonAction)
|
||||
break;
|
||||
}
|
||||
|
||||
case BUTTON_ACTION_CLONE:
|
||||
{
|
||||
CommandExecute("CLONE");
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -32,6 +32,7 @@ typedef enum {
|
||||
BUTTON_ACTION_RECALL_MEM,
|
||||
BUTTON_ACTION_TOGGLE_FIELD,
|
||||
BUTTON_ACTION_STORE_LOG,
|
||||
BUTTON_ACTION_CLONE,
|
||||
|
||||
/* This has to be last element */
|
||||
BUTTON_ACTION_COUNT
|
||||
|
||||
@@ -309,6 +309,13 @@ const PROGMEM CommandEntryType CommandTable[] = {
|
||||
.SetFunc = CommandSetField,
|
||||
.GetFunc = CommandGetField
|
||||
},
|
||||
{
|
||||
.Command = COMMAND_CLONE,
|
||||
.ExecFunc = CommandExecClone,
|
||||
.ExecParamFunc = NO_FUNCTION,
|
||||
.SetFunc = NO_FUNCTION,
|
||||
.GetFunc = NO_FUNCTION
|
||||
},
|
||||
{ /* This has to be last element */
|
||||
.Command = COMMAND_LIST_END,
|
||||
.ExecFunc = NO_FUNCTION,
|
||||
@@ -396,6 +403,20 @@ static CommandStatusIdType CallCommandFunc(
|
||||
return Status;
|
||||
}
|
||||
|
||||
void CommandExecute(const char* command)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(CommandTable); i++)
|
||||
{
|
||||
if (strcmp_P(command, CommandTable[i].Command) == 0)
|
||||
{
|
||||
CallCommandFunc(&CommandTable[i], CHAR_EXEC_MODE, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void DecodeCommand(void)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
@@ -15,6 +15,7 @@ void CommandLineInit(void);
|
||||
bool CommandLineProcessByte(uint8_t Byte);
|
||||
void CommandLineTick(void);
|
||||
|
||||
void CommandExecute(const char* command);
|
||||
void CommandLineAppendData(void const * const Buffer, uint16_t Bytes);
|
||||
|
||||
/* Functions for timeout commands */
|
||||
|
||||
@@ -639,3 +639,17 @@ CommandStatusIdType CommandExecAutocalibrate(char* OutMessage)
|
||||
CommandLinePendingTaskTimeout = &Reader14443AAppTimeout;
|
||||
return TIMEOUT_COMMAND;
|
||||
}
|
||||
|
||||
CommandStatusIdType CommandExecClone(char *OutMessage)
|
||||
{
|
||||
ConfigurationSetById(CONFIG_ISO14443A_READER);
|
||||
|
||||
ApplicationReset();
|
||||
|
||||
Reader14443CurrentCommand = Reader14443_Identify_Clone;
|
||||
Reader14443AAppInit();
|
||||
Reader14443ACodecStart();
|
||||
CommandLinePendingTaskTimeout = &Reader14443AAppTimeout;
|
||||
|
||||
return TIMEOUT_COMMAND;
|
||||
}
|
||||
|
||||
@@ -184,6 +184,9 @@ CommandStatusIdType CommandExecAutocalibrate(char* OutMessage);
|
||||
CommandStatusIdType CommandSetField(char* OutMessage, const char* InParam);
|
||||
CommandStatusIdType CommandGetField(char* OutMessage);
|
||||
|
||||
#define COMMAND_CLONE "CLONE"
|
||||
CommandStatusIdType CommandExecClone(char* OutMessage);
|
||||
|
||||
#define COMMAND_LIST_END ""
|
||||
/* Defines the end of command list. This is no actual command */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user