-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheeprom.h
More file actions
36 lines (29 loc) · 2.14 KB
/
eeprom.h
File metadata and controls
36 lines (29 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// EEPROM functions
// Nathan Fusselman
//-----------------------------------------------------------------------------
// Hardware Target
//-----------------------------------------------------------------------------
// Target uC: TM4C123GH6PM
// System Clock: -
#ifndef EEPROM_H_
#define EEPROM_H_
#define MAX_STRING_LENGTH 16 //Max size of name string, optimal if a multiple of 4
#define SIZE_LOC 0 //Location in EEPROM of the Size Variable
//-----------------------------------------------------------------------------
// Subroutines
//-----------------------------------------------------------------------------
void initEeprom(void); //Provided function by my main man Losh that initializes the EEPROM Module.
void writeEeprom(uint16_t, uint32_t); //Provided function by my main man Losh that writes a 32bit word to the EEPROM at a 16bit address location.
uint32_t readEeprom(uint16_t); //Provided function by my main man Losh that reads a 32bit word from the EEPROM at a 16bit address location.
void clearAllCommands(void); //Sets the Size of saved commands to 0 so that it will start rewriting at the first block in the EEPROM.
void addCommand(char *, uint8_t, uint8_t); //Creates and adds block to EEPROM containing the command data.
uint8_t getIndex(char *); //Returns the entry index of a block saved in the EEPROM
uint16_t getCommand(char *); //Return the addr and data for a command as a 16bit item | addr | data |
void getName(uint8_t);
void infoCommand(uint8_t); //Prints info for a command given the block index
void infoCommandName(char *); //Prints info for a command given the name
void eraseCommand(uint8_t); //Erases a block of memory leaving it empty given the index
void eraseCommandName(char *); //Erases a block of memory leaving it empty given the name
uint8_t findCommand(uint8_t, uint8_t); //Returns the index of a command given the addr and data
void printCommands(void); //Prints a list of all saved commands in EEPROM
#endif