Remove test commands
This commit is contained in:
parent
b5c5fd4ede
commit
213a143089
|
|
@ -37,14 +37,6 @@ void executeCommand(CommandLine cmdLine) {
|
||||||
// ERASE command: Takes a hex address range as argument and writes 0x00 bytes to the specified range.
|
// ERASE command: Takes a hex address range as argument and writes 0x00 bytes to the specified range.
|
||||||
commandErase(cmdLine.arg);
|
commandErase(cmdLine.arg);
|
||||||
}
|
}
|
||||||
else if (strcmp(cmdLine.command, "TESTREAD") == 0) {
|
|
||||||
// TESTREAD command: for testing purposes, reads a few bytes and returns them in a human readable format.
|
|
||||||
commandTestRead();
|
|
||||||
}
|
|
||||||
else if (strcmp(cmdLine.command, "TESTWRITE") == 0) {
|
|
||||||
// TESTWRITE command: for testing purposes, writes a few bytes
|
|
||||||
commandTestWrite(cmdLine.arg);
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
// unknown command: return error message
|
// unknown command: return error message
|
||||||
uartPutLine("ERROR invalid command");
|
uartPutLine("ERROR invalid command");
|
||||||
|
|
@ -80,11 +72,6 @@ void commandHelp() {
|
||||||
uartPutLine("HELP - READ 0000:0FFF");
|
uartPutLine("HELP - READ 0000:0FFF");
|
||||||
uartPutLine("HELP - WRITE 0000");
|
uartPutLine("HELP - WRITE 0000");
|
||||||
uartPutLine("HELP - ERASE 0000:0FFF");
|
uartPutLine("HELP - ERASE 0000:0FFF");
|
||||||
|
|
||||||
// TODO remove those
|
|
||||||
uartPutLine("HELP - TESTREAD (only for testing)");
|
|
||||||
uartPutLine("HELP - TESTWRITE (only for testing)");
|
|
||||||
|
|
||||||
uartPutLine("OK");
|
uartPutLine("OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -233,51 +220,3 @@ void commandErase(char* arg) {
|
||||||
uartPutLine(" bytes");
|
uartPutLine(" bytes");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TESTREAD command: for testing purposes, reads a few bytes and returns them in a human readable format.
|
|
||||||
void commandTestRead() {
|
|
||||||
eepromSetReadMode();
|
|
||||||
|
|
||||||
for (uint8_t i = 0x00; i < 0x20; i++) {
|
|
||||||
uartPutString("TESTREAD 0x");
|
|
||||||
uartPutHexByte(i);
|
|
||||||
uartPutString(": ");
|
|
||||||
|
|
||||||
uint8_t byte = eepromReadByte(i);
|
|
||||||
|
|
||||||
if (byte >= 32 && byte <= 126) {
|
|
||||||
uartPutChar(byte);
|
|
||||||
} else {
|
|
||||||
uartPutChar('?');
|
|
||||||
}
|
|
||||||
|
|
||||||
uartPutString(" (0x");
|
|
||||||
uartPutHexByte(byte);
|
|
||||||
uartPutLine(")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TESTWRITE command: for testing purposes, writes a few bytes
|
|
||||||
void commandTestWrite(char* arg) {
|
|
||||||
char str[] = "Ohai world";
|
|
||||||
address_t addr = 0x00;
|
|
||||||
|
|
||||||
char* writeStr = str;
|
|
||||||
if (arg != NULL) {
|
|
||||||
writeStr = arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
eepromSetWriteMode();
|
|
||||||
|
|
||||||
// write input line instead of static string
|
|
||||||
for (char* p = writeStr; *p != '\0'; p++) {
|
|
||||||
eepromWriteByte(addr, *p);
|
|
||||||
//_delay_ms(100);
|
|
||||||
addr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO necessary?
|
|
||||||
_delay_ms(100);
|
|
||||||
|
|
||||||
uartPutLine("TESTWRITE success");
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,4 @@ void commandRead(char* arg);
|
||||||
void commandWrite(char* arg);
|
void commandWrite(char* arg);
|
||||||
void commandErase();
|
void commandErase();
|
||||||
|
|
||||||
// TODO commands only for testing
|
|
||||||
void commandTestRead();
|
|
||||||
void commandTestWrite(char* arg);
|
|
||||||
|
|
||||||
#endif /* COMMANDS_H_ */
|
#endif /* COMMANDS_H_ */
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
|
|
||||||
// Define address length
|
|
||||||
// TODO 15 or 16?
|
|
||||||
#define ADDRESS_LENGTH 15
|
|
||||||
|
|
||||||
// Macros for IO pins
|
// Macros for IO pins
|
||||||
#define EEP_ADDR_LOW_PORT PORTC
|
#define EEP_ADDR_LOW_PORT PORTC
|
||||||
#define EEP_ADDR_LOW_DDR DDRC
|
#define EEP_ADDR_LOW_DDR DDRC
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue