PingPong/Core/Inc/EEPROM.h
2024-08-20 22:26:27 +03:00

53 lines
1.5 KiB
C

#include "stm32f1xx_hal.h"
#define AT24C_ADRESS 0x50 // i2c slave adress EEPROM
#define FLASH_BLOCKSIZE 64
#define START_ADR_SHOT 0x0000 //00000
#define START_ADR_PROGRAM 0x3000 //12288
#define START_ADR_MACRO 0x6000 //24576
#define MAX_NUMBER_MACRO 100
#define MAX_NUMBER_SHOTS 160
#define MAX_NUMBER_PROGRAMS 100
#define MAX_NUMBER_SHOTS_IN_PROGRAMS 31
#define MAX_NUMBER_PROGRAMS_IN_MACRO 16
struct StructNumberScrewCount{
unsigned char number;
unsigned char speedScrew;
unsigned char countRepeat;
unsigned char options;
};
struct StructNumberScrew{
unsigned char number;
unsigned char speedScrew;
};
struct StructShot {
unsigned char countRepeatShot;
unsigned char speedRollerTop;
unsigned char speedRollerBottom;
unsigned char speedScrew;
unsigned char rotationAxial;
unsigned char rotationHorizontal;
unsigned char rotationVertical;
};
struct StructProgram {
unsigned char countRepeat;
unsigned char options;
struct StructNumberScrew numberScrew[MAX_NUMBER_SHOTS_IN_PROGRAMS];
};
struct StructMacro {
struct StructNumberScrewCount numberScrewCount[MAX_NUMBER_PROGRAMS_IN_MACRO];
};
void SaveShot(unsigned char number, struct StructShot* shot);
void FLASH_WriteBlock(uint8_t *writeAddr, unsigned char *flashWrBufPtr);
struct StructShot GetShot( unsigned char number );