30 lines
729 B
C
30 lines
729 B
C
|
|
#ifndef PARSING_H_
|
||
|
|
#define PARSING_H_
|
||
|
|
|
||
|
|
#include "config.h"
|
||
|
|
#include "eeprom.h"
|
||
|
|
#include <stdbool.h>
|
||
|
|
|
||
|
|
// Type definition for a command line with optional argument (actually just two pointers to strings)
|
||
|
|
typedef struct {
|
||
|
|
char* command;
|
||
|
|
char* arg;
|
||
|
|
} CommandLine;
|
||
|
|
|
||
|
|
// Type definition for address ranges (from-to)
|
||
|
|
typedef struct {
|
||
|
|
bool isValid;
|
||
|
|
address_t from;
|
||
|
|
address_t to;
|
||
|
|
} AddressRange;
|
||
|
|
|
||
|
|
void parseNextCommand();
|
||
|
|
CommandLine readNextCommand(char* buffer, uint8_t bufferLength);
|
||
|
|
CommandLine tokenizeCommand(char* cmd);
|
||
|
|
|
||
|
|
bool parseSingleAddressTo(char* addressStr, address_t* address);
|
||
|
|
AddressRange parseSingleAddress(char* addressStr);
|
||
|
|
AddressRange parseAddressRange(char* addressStr);
|
||
|
|
|
||
|
|
#endif /* PARSING_H_ */
|