mirror of
https://github.com/DashyFox/StackSport.git
synced 2025-05-04 07:10:17 +00:00
53 lines
1.5 KiB
C
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
|
|
|
|
typedef struct MacroProgram{
|
|
unsigned char id;
|
|
unsigned char speedScrew;
|
|
unsigned char countRepeat;
|
|
unsigned char options;
|
|
}MacroProgram;
|
|
|
|
typedef struct ProgramShot{
|
|
unsigned char id;
|
|
unsigned char speedScrew;
|
|
}ProgramShot;
|
|
|
|
typedef struct Shot {
|
|
unsigned char countRepeatShot;
|
|
unsigned char speedRollerTop;
|
|
unsigned char speedRollerBottom;
|
|
unsigned char speedScrew;
|
|
unsigned char rotationAxial;
|
|
unsigned char rotationHorizontal;
|
|
unsigned char rotationVertical;
|
|
}Shot;
|
|
|
|
typedef struct Program {
|
|
unsigned char countRepeat;
|
|
unsigned char options;
|
|
ProgramShot shots[MAX_NUMBER_SHOTS_IN_PROGRAMS];
|
|
}Program;
|
|
|
|
typedef struct Macro {
|
|
MacroProgram programs[MAX_NUMBER_PROGRAMS_IN_MACRO];
|
|
} Macro;
|
|
|
|
void SaveShot(unsigned char number, struct Shot* shot);
|
|
void FLASH_WriteBlock(uint8_t *writeAddr, unsigned char *flashWrBufPtr);
|
|
|
|
Shot GetShot( unsigned char number );
|
|
|