Refactoring: common.h with common typedefs etc.
This commit is contained in:
parent
3a07b3ab6f
commit
55b08b7630
|
|
@ -1,5 +1,5 @@
|
||||||
#include "config.h"
|
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
|
#include "common.h"
|
||||||
#include "parsing.h"
|
#include "parsing.h"
|
||||||
#include "uart.h"
|
#include "uart.h"
|
||||||
#include "eeprom.h"
|
#include "eeprom.h"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef COMMANDS_H_
|
#ifndef COMMANDS_H_
|
||||||
#define COMMANDS_H_
|
#define COMMANDS_H_
|
||||||
|
|
||||||
#include "config.h"
|
#include "common.h"
|
||||||
#include "parsing.h"
|
#include "parsing.h"
|
||||||
|
|
||||||
void executeCommand(CommandLine cmdLine);
|
void executeCommand(CommandLine cmdLine);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
#ifndef COMMON_H_
|
||||||
|
#define COMMON_H_
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
// Define macro for NOP instruction
|
||||||
|
#define _NOP() __asm__ __volatile__ ("nop");
|
||||||
|
|
||||||
|
// Define type for EEPROM addresses
|
||||||
|
typedef uint16_t address_t;
|
||||||
|
|
||||||
|
// Type definition for address ranges (from-to)
|
||||||
|
typedef struct {
|
||||||
|
bool isValid;
|
||||||
|
address_t from;
|
||||||
|
address_t to;
|
||||||
|
} AddressRange;
|
||||||
|
|
||||||
|
#endif /* COMMON_H_ */
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
#include "config.h"
|
|
||||||
#include "eeprom.h"
|
#include "eeprom.h"
|
||||||
|
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,9 @@
|
||||||
#define EEPROM_H_
|
#define EEPROM_H_
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "common.h"
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
|
|
||||||
// Define macro for NOP instruction
|
|
||||||
#define _NOP() __asm__ __volatile__ ("nop");
|
|
||||||
|
|
||||||
// Define type for (to be shifted) addresses
|
|
||||||
typedef uint16_t address_t;
|
|
||||||
|
|
||||||
// Define address length
|
// Define address length
|
||||||
// TODO 15 or 16?
|
// TODO 15 or 16?
|
||||||
#define ADDRESS_LENGTH 15
|
#define ADDRESS_LENGTH 15
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "common.h"
|
||||||
#include "uart.h"
|
#include "uart.h"
|
||||||
#include "eeprom.h"
|
#include "eeprom.h"
|
||||||
#include "parsing.h"
|
#include "parsing.h"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
#ifndef PARSING_H_
|
#ifndef PARSING_H_
|
||||||
#define PARSING_H_
|
#define PARSING_H_
|
||||||
|
|
||||||
#include "config.h"
|
#include "common.h"
|
||||||
#include "eeprom.h"
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
// Type definition for a command line with optional argument (actually just two pointers to strings)
|
// Type definition for a command line with optional argument (actually just two pointers to strings)
|
||||||
|
|
@ -11,13 +10,6 @@ typedef struct {
|
||||||
char* arg;
|
char* arg;
|
||||||
} CommandLine;
|
} CommandLine;
|
||||||
|
|
||||||
// Type definition for address ranges (from-to)
|
|
||||||
typedef struct {
|
|
||||||
bool isValid;
|
|
||||||
address_t from;
|
|
||||||
address_t to;
|
|
||||||
} AddressRange;
|
|
||||||
|
|
||||||
void parseNextCommand();
|
void parseNextCommand();
|
||||||
CommandLine readNextCommand(char* buffer, uint8_t bufferLength);
|
CommandLine readNextCommand(char* buffer, uint8_t bufferLength);
|
||||||
CommandLine tokenizeCommand(char* cmd);
|
CommandLine tokenizeCommand(char* cmd);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue