firstTest

This commit is contained in:
2024-08-20 22:26:27 +03:00
parent eefbc336fa
commit 2c2ebd7137
15 changed files with 930 additions and 25 deletions

52
Core/Inc/EEPROM.h Normal file
View File

@ -0,0 +1,52 @@
#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 );

19
Core/Inc/IR.h Normal file
View File

@ -0,0 +1,19 @@
#include "stm32f1xx_hal.h"
#define STATUS_START 0
#define STATUS_COMMAND 1
#define STATUS_ADDRESS 2
#define STATUS_REPEAT 3
#define STATUS_ERROR 10
extern unsigned char IR_Command;
extern unsigned char IR_Address;
extern unsigned char IR_CommandNumber[3];
extern unsigned char IRStatus;
void IR_handler(void);
void ClearIRStatus(void);
void ClearIRCommand(void);
void ClearIR(void);
void SetShiftReg (unsigned char shiftreg[3]);

11
Core/Inc/Print.h Normal file
View File

@ -0,0 +1,11 @@
#include "usbd_cdc_if.h"
#include <stdio.h> // Для функции sprintf
#include <stdint.h>
#include <string.h> // Для функции strlen
#define BUFFER_SIZE 32 // Размер буфера для строки
void print(char* str);
void int_to_str(int number, char *str, int base);
void printNumber(long int number);

7
Core/Inc/pca9685.h Normal file
View File

@ -0,0 +1,7 @@
#include "stm32f1xx_hal.h"
extern I2C_HandleTypeDef hi2c1;
void initPCA9685(void);
void SetServo(uint8_t channel, uint8_t angel);