mirror of
https://github.com/DashyFox/StackSport.git
synced 2025-06-28 05:09:32 +00:00
prepare EEPROM and logic funcs
This commit is contained in:
@ -26,54 +26,103 @@
|
||||
|
||||
#define MEMORY_END (START_ADR_MACRO + (MACRO_BLOCKSIZE*MAX_NUMBER_MACRO)) // 0x78FA = 30970
|
||||
|
||||
typedef enum MemoryStatus {
|
||||
EEPROM_FAIL,
|
||||
EEPROM_MISSING_ELEMENT,
|
||||
EEPROM_OUT_OF_RANGE,
|
||||
EEPROM_WRONG_STARTADDR,
|
||||
EEPROM_OK
|
||||
} MemoryStatus;
|
||||
|
||||
typedef struct Shot {
|
||||
unsigned char isExist;
|
||||
unsigned char countRepeatShot;
|
||||
unsigned char speedRollerTop; // 0 .. 100 .. 200
|
||||
unsigned char speedRollerBottom; // 0 .. 100 .. 200
|
||||
unsigned char speedScrew; // 0 .. 100
|
||||
unsigned char rotationAxial; // 0 .. 90 .. 180
|
||||
unsigned char rotationHorizontal; // 0 .. 90 .. 180
|
||||
unsigned char rotationVertical; // 0 .. 90 .. 180
|
||||
}Shot;
|
||||
unsigned char isExist;
|
||||
unsigned char countRepeatShot; // 0 = inf
|
||||
unsigned char speedRollerTop; // 0 .. 100 .. 200
|
||||
unsigned char speedRollerBottom; // 0 .. 100 .. 200
|
||||
unsigned char speedScrew; // 0 .. 100
|
||||
unsigned char rotationAxial; // 0 .. 90 .. 180
|
||||
unsigned char rotationHorizontal; // 0 .. 90 .. 180
|
||||
unsigned char rotationVertical; // 0 .. 90 .. 180
|
||||
} Shot;
|
||||
|
||||
typedef struct ProgramHeader {
|
||||
unsigned char isExist;
|
||||
unsigned char countRepeat;
|
||||
unsigned char options;
|
||||
}ProgramHeader;
|
||||
|
||||
unsigned char isExist;
|
||||
unsigned char countRepeat;
|
||||
unsigned char options;
|
||||
} ProgramHeader;
|
||||
|
||||
typedef struct ProgramShot {
|
||||
unsigned char id;
|
||||
unsigned char speedScrew;
|
||||
}ProgramShot;
|
||||
unsigned char id;
|
||||
unsigned char speedScrew;
|
||||
} ProgramShot;
|
||||
|
||||
typedef struct Program {
|
||||
ProgramHeader header;
|
||||
ProgramShot shots[MAX_NUMBER_SHOTS_IN_PROGRAMS];
|
||||
}Program;
|
||||
ProgramHeader header;
|
||||
ProgramShot shots[MAX_NUMBER_SHOTS_IN_PROGRAMS];
|
||||
} Program;
|
||||
|
||||
typedef struct MacroHeader {
|
||||
unsigned char isExist;
|
||||
}MacroHeader;
|
||||
unsigned char isExist;
|
||||
} MacroHeader;
|
||||
|
||||
typedef struct MacroProgram {
|
||||
unsigned char id;
|
||||
unsigned char speedScrew;
|
||||
unsigned char countRepeat;
|
||||
unsigned char options;
|
||||
}MacroProgram;
|
||||
} MacroProgram;
|
||||
|
||||
typedef struct Macro {
|
||||
MacroHeader header;
|
||||
MacroProgram programs[MAX_NUMBER_PROGRAMS_IN_MACRO];
|
||||
} Macro;
|
||||
MacroHeader header;
|
||||
MacroProgram programs[MAX_NUMBER_PROGRAMS_IN_MACRO];
|
||||
} Macro;
|
||||
|
||||
void FLASH_WriteBlock(uint16_t startAddr, uint8_t number,uint8_t *writeData);
|
||||
void FLASH_ReadBlock(uint16_t startAddr, uint8_t number, uint8_t *outData);
|
||||
typedef struct ServoSetting {
|
||||
uint8_t invert;
|
||||
uint16_t min;
|
||||
uint16_t def;
|
||||
uint16_t max;
|
||||
} ServoSetting;
|
||||
|
||||
typedef struct DelayTimes{
|
||||
uint16_t preRun;
|
||||
}DelayTimes;
|
||||
|
||||
typedef struct Motors{
|
||||
uint16_t speed_Rollers_min;
|
||||
// uint16_t speed_Rollers_max;
|
||||
|
||||
uint16_t speed_Screw_min;
|
||||
// uint16_t speed_Screw_max;
|
||||
}Motors;
|
||||
|
||||
typedef struct HardwareInit_t{
|
||||
DelayTimes timings;
|
||||
ServoSetting servos[3];
|
||||
Motors motors;
|
||||
}HardwareInit_t;
|
||||
|
||||
typedef struct Statistics{
|
||||
uint16_t totalShots;
|
||||
uint16_t totalPrograms;
|
||||
uint16_t totalMacros;
|
||||
}Statistics;
|
||||
|
||||
|
||||
void SaveShot(unsigned char number, struct Shot* shot);
|
||||
Shot GetShot( unsigned char number );
|
||||
MemoryStatus FLASH_WriteBlock(uint16_t startAddr, uint8_t number,
|
||||
uint8_t *writeData);
|
||||
MemoryStatus FLASH_ReadBlock(uint16_t startAddr, uint8_t number,
|
||||
uint8_t *outData);
|
||||
|
||||
MemoryStatus saveShot(unsigned char number, Shot *shot);
|
||||
MemoryStatus getShot(unsigned char number, Shot *shot);
|
||||
|
||||
MemoryStatus saveProg(unsigned char number, Program *prog);
|
||||
MemoryStatus getProg(unsigned char number, Program *prog);
|
||||
|
||||
MemoryStatus saveMacro(unsigned char number, Macro *macro);
|
||||
MemoryStatus getMacro(unsigned char number, Macro *macro);
|
||||
|
||||
MemoryStatus getHardwareInit();
|
||||
|
||||
#endif /* INC_EEPROM_H_ */
|
||||
|
Reference in New Issue
Block a user