перенес все файлы Димы в пересобраный проект

This commit is contained in:
2025-08-22 17:31:23 +03:00
parent 120ec1cd90
commit d6c3e5d7be
44 changed files with 8282 additions and 5259 deletions

View File

@@ -41,7 +41,9 @@ extern CAN_HandleTypeDef hcan;
void MX_CAN_Init(void);
/* USER CODE BEGIN Prototypes */
int CAN_send(uint16_t data[], int Addr, int Qua);
void Setup_CAN_addr(uint8_t mode);
void CAN_filterConfig(void);
/* USER CODE END Prototypes */
#ifdef __cplusplus

10
Core/Inc/crc16.h Normal file
View File

@@ -0,0 +1,10 @@
#include "stdint.h"
typedef unsigned short WORD;
typedef unsigned char byte;
unsigned int get_crc_ccitt(unsigned int crc, unsigned int *buf, unsigned long size );
unsigned int get_crc_16(unsigned int crc,unsigned int *buf,unsigned long size );
unsigned int get_crc_16b(unsigned int crc,unsigned int *buf,unsigned long size );
int get_crc16(uint16_t *buf, int size );

20
Core/Inc/eeprom.h Normal file
View File

@@ -0,0 +1,20 @@
#ifndef __EEPROM_H
#define __EEPROM_H
#ifdef __cplusplus
extern "C" {
#endif
#include "stm32f1xx_hal.h"
#define FLASH_EEPROM_BASE 0x0801F800
#define FLASH_STARTO 0xBABEFACE
void putIntoEeprom(uint16_t, uint16_t*);
uint16_t watInTheFlash(uint32_t);
#ifdef __cplusplus
}
#endif
#endif /* __EEPROM_H */

30
Core/Inc/lampa.h Normal file
View File

@@ -0,0 +1,30 @@
#ifndef __LAMPA_H
#define __LAMPA_H
/*
* Применяется метод Слой аппаратных абстракции(HAL) так он последний(модный),
* тут описано библиотечные вызовы
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "main.h"
#include "stdbool.h"
#define Delay 1000
#define numUno 1
#define numNul 0
void ReadEnteres(void);
uint16_t ReadJumpers(void);
uint16_t TestJumper(void);
void ReadSeanus(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -114,9 +114,83 @@ void Error_Handler(void);
#define LED1_Pin GPIO_PIN_6
#define LED1_GPIO_Port GPIOB
/* USER CODE BEGIN Private defines */
#define Jselect SELEKT_PCH
/////////// USER define /////////
#define Jselect HAL_GPIO_ReadPin(Jselect_GPIO_Port, Jselect_Pin)
#define Jselect_Pin GPIO_PIN_14
#define Jselect_GPIO_Port GPIOC
#define LED_0_OFF HAL_GPIO_WritePin(LED0_GPIO_Port, LED0_Pin, GPIO_PIN_SET) //Set or clear the selected data port bit
#define LED_0_ON HAL_GPIO_WritePin(LED0_GPIO_Port, LED0_Pin, GPIO_PIN_RESET) //??? ?????? ?? ??????????
#define LED_0_TGL HAL_GPIO_TogglePin(LED0_GPIO_Port, LED0_Pin)
#define LED_1_OFF HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_SET) //Set or clear the selected data port bit
#define LED_1_ON HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_RESET) //??? ?????? ?? ??????????
#define LED_1_TGL HAL_GPIO_TogglePin(LED1_GPIO_Port, LED1_Pin)
#define LED_2_ON HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_SET) //Set or clear the selected data port bit
#define LED_2_OFF HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_RESET) //??? ?????? ?? ??????????
#define LED_2_TGL HAL_GPIO_TogglePin(LED2_GPIO_Port, LED2_Pin)
#define LED_3_ON HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_SET) //Set or clear the selected data port bit
#define LED_3_OFF HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET) //??? ?????? ?? ??????????
#define LED_3_TGL HAL_GPIO_TogglePin(LED3_GPIO_Port, LED3_Pin)
#define Pvt1_ON HAL_GPIO_WritePin(PVT1_GPIO_Port, PVT1_Pin, GPIO_PIN_SET) //Set or clear the selected data port bit
#define Pvt1_OFF HAL_GPIO_WritePin(PVT1_GPIO_Port, PVT1_Pin, GPIO_PIN_RESET) //??? ?????? ?? ??????????
#define Pvt1_TGL HAL_GPIO_TogglePin(PVT1_GPIO_Port, PVT1_Pin)
#define Pvt2_ON HAL_GPIO_WritePin(PVT2_GPIO_Port, PVT2_Pin, GPIO_PIN_SET) //set - ????????????? ???, reset - ??????? ???
#define Pvt2_OFF HAL_GPIO_WritePin(PVT2_GPIO_Port, PVT2_Pin, GPIO_PIN_RESET) //????? ??????? ? main.h ??????? ?????? ?????????????
#define Pvt2_TGL HAL_GPIO_TogglePin(PVT2_GPIO_Port, PVT2_Pin)
#define Pvt3_ON HAL_GPIO_WritePin(PVT3_GPIO_Port, PVT3_Pin, GPIO_PIN_SET)
#define Pvt3_OFF HAL_GPIO_WritePin(PVT3_GPIO_Port, PVT3_Pin, GPIO_PIN_RESET)
#define Pvt3_TGL HAL_GPIO_TogglePin(PVT3_GPIO_Port, PVT3_Pin)
#define Pvt4_ON HAL_GPIO_WritePin(PVT4_GPIO_Port, PVT4_Pin, GPIO_PIN_SET)
#define Pvt4_OFF HAL_GPIO_WritePin(PVT4_GPIO_Port, PVT4_Pin, GPIO_PIN_RESET)
#define Pvt4_TGL HAL_GPIO_TogglePin(PVT4_GPIO_Port, PVT4_Pin)
#define IN_01 HAL_GPIO_ReadPin(IN_01_GPIO_Port, IN_01_Pin) // ???????? ??1 (??????? ???????????? ???????????)
#define IN_02 HAL_GPIO_ReadPin(IN_02_GPIO_Port, IN_02_Pin) // ???????? ??2 (??????? ???????????? ?????????)
#define IN_03 HAL_GPIO_ReadPin(IN_03_GPIO_Port, IN_03_Pin) // ???????? ??3 (??????? ??. ??????, ???? ?????????, ????)
#define IN_04 HAL_GPIO_ReadPin(IN_04_GPIO_Port, IN_04_Pin) // ???????? ??4 (??????? ???????? ???? ? ?????????? +)
#define IN_05 HAL_GPIO_ReadPin(IN_05_GPIO_Port, IN_05_Pin) // ???????? ??5 (??????? ???????? ???? ? ?????????? )
#define IN_06 HAL_GPIO_ReadPin(IN_06_GPIO_Port, IN_06_Pin) // ???????? ??6 (??????? ?????????)
#define IN_07 HAL_GPIO_ReadPin(IN_07_GPIO_Port, IN_07_Pin) // ???????? 3? ??????? 380 ?
#define IN_08 HAL_GPIO_ReadPin(IN_08_GPIO_Port, IN_08_Pin) // ????? ??????????
#define IN_09 HAL_GPIO_ReadPin(IN_09_GPIO_Port, IN_09_Pin) // ?????? ??????????
#define IN_10 HAL_GPIO_ReadPin(IN_10_GPIO_Port, IN_10_Pin) // ?????? ? ???? 24 ?
#define IN_11 HAL_GPIO_ReadPin(IN_11_GPIO_Port, IN_11_Pin) // ???????? ??????? ???
#define IN_12 HAL_GPIO_ReadPin(IN_12_GPIO_Port, IN_12_Pin) // ??????
#define IN_13 HAL_GPIO_ReadPin(IN_13_GPIO_Port, IN_13_Pin) // ??????
#define IN_14 HAL_GPIO_ReadPin(IN_14_GPIO_Port, IN_14_Pin) // ???????? ??????? ???
#define J0 HAL_GPIO_ReadPin(J0_GPIO_Port, J0_Pin) //Read the specified input port pin
#define J1 HAL_GPIO_ReadPin(J1_GPIO_Port, J1_Pin)
#define J2 HAL_GPIO_ReadPin(J2_GPIO_Port, J2_Pin)
#define J3 HAL_GPIO_ReadPin(J3_GPIO_Port, J3_Pin)
/////////////////////////////////
int Isit(int num, int i, int z);
typedef struct // ñòðóêòóðà ôëàãîâ
{
uint8_t force_pause:1;
uint32_t pause;
// uint8_t
// uint16_t
}FLAG;
/* USER CODE END Private defines */
#ifdef __cplusplus

25
Core/Inc/message.h Normal file
View File

@@ -0,0 +1,25 @@
#ifndef MESSAGE_H
#define MESSAGE_H
#include "stdint.h"
#include "struc.h"
typedef unsigned char CHAR;
#define Modbus_LEN 0x000080
#define Modbus ((WORDE *)modbus)
#define Params ((WORDE *)params)
extern uint16_t Mode;
extern uint16_t modbus[],params[],archiv[],county[],espero[];
extern LONGE* outputs;
extern uint16_t Maska[][8];
void Save_params(void);
void Load_params(void);
void Default_params(void);
#endif //MESSAGE_H

77
Core/Inc/package.h Normal file
View File

@@ -0,0 +1,77 @@
#ifndef PACKAGE
#define PACKAGE
#define PROTOKOL 3
#define m_FAST 0
#define m_SLOW 1
#define keys 0x0 // адрес повтораемой посылки «keys»
#define Inputs Modbus[0x0]
#define Alarms Modbus[0x1]
#define Errors Modbus[0x2]
#define Alarm_mask Modbus[0x8]
#define Error_mask Modbus[0x9]
#define Jumpers Modbus[0x10]
#define Buttons Modbus[0x11]
#define jumpers modbus[0x10]
#define buttons modbus[0x11]
#define Squazh_U (modbus+0x18)
#define Sleep_time modbus[0x48]
#define Squazh_L (modbus+0x30)
#define Cancount (modbus+0x60) // пауза между посылками CAN
#define CanWait (modbus+0x62) // пауза после прохождениа цикла
#define CanRestart (modbus+0x64) // перезапуск посылки
#define CanRptVez modbus[0x66] // кол-во повторений посылки «keys»
#define CanRptLen modbus[0x67] // длина повтораемой посылки «keys»
#define Brightness modbus[0x68] // аркость сигнальной лампочки
#define Lightness modbus[0x6A] // управление сигнальной лампочки
#define cancyclo 0x78 // его адрес
#define CanCycle (modbus+0x78) // счетчик циклов CAN
#define CanRound (modbus+0x7A) // счетчик еще более полных циклов CAN
#define Protokol modbus[125]
#define LastMode modbus[126]
#define Commands modbus[127]
#define command params[128]
#define bit_command Params[128]
#define cTestLamp bit_command.bit.bit0
#define cDefParam bit_command.bit.bit1
#define cSaveParam bit_command.bit.bit2
#define cLoadParam bit_command.bit.bit3
#define cTermoCal bit_command.bit.bit4
#define cKoefCalc bit_command.bit.bit5
#define cSecretBt bit_command.bit.bit6
#define cCanReset bit_command.bit.bit7
#define cRawMeat bit_command.bit.bit8
#define cCanReset bit_command.bit.bit7
#define cReset bit_command.bit.bitF
/*
#define cTestLamp Modbus[127].bit.bit0
#define cDefParam Modbus[127].bit.bit1
#define cSaveParam Modbus[127].bit.bit2
#define cLoadParam Modbus[127].bit.bit3
#define cTermoCal Modbus[127].bit.bit4
#define cKoefCalc Modbus[127].bit.bit5
#define cSecretBt Modbus[127].bit.bit6
#define cCanReset Modbus[127].bit.bit7
#define cRawMeat Modbus[127].bit.bit8
#define cCanReset Modbus[127].bit.bit7
#define cReset Modbus[127].bit.bitF
*/
#endif //PACKAGE

153
Core/Inc/struc.h Normal file
View File

@@ -0,0 +1,153 @@
#ifndef __STRUC_H
#define __STRUC_H
#ifdef __cplusplus
extern "C" {
#endif
typedef union
{
struct
{
unsigned char bit0: 1;
unsigned char bit1: 1;
unsigned char bit2: 1;
unsigned char bit3: 1;
unsigned char bit4: 1;
unsigned char bit5: 1;
unsigned char bit6: 1;
unsigned char bit7: 1;
} bit;
struct
{
unsigned char quad_0 :4;
unsigned char quad_1 :4;
} qua;
unsigned char all;
} BAITE;
typedef union
{
struct
{
unsigned short int bit0: 1;
unsigned short int bit1: 1;
unsigned short int bit2: 1;
unsigned short int bit3: 1;
unsigned short int bit4: 1;
unsigned short int bit5: 1;
unsigned short int bit6: 1;
unsigned short int bit7: 1;
unsigned short int bit8: 1;
unsigned short int bit9: 1;
unsigned short int bitA: 1;
unsigned short int bitB: 1;
unsigned short int bitC: 1;
unsigned short int bitD: 1;
unsigned short int bitE: 1;
unsigned short int bitF: 1;
} bit;
struct
{
unsigned short int quad_0 :4;
unsigned short int quad_1 :4;
unsigned short int quad_2 :4;
unsigned short int quad_3 :4;
} qua;
struct
{
unsigned short int byte_0 :8;
unsigned short int byte_1 :8;
} byt;
unsigned short int all;
} WORDE;
typedef union
{
struct
{
unsigned int bit00: 1;
unsigned int bit01: 1;
unsigned int bit02: 1;
unsigned int bit03: 1;
unsigned int bit04: 1;
unsigned int bit05: 1;
unsigned int bit06: 1;
unsigned int bit07: 1;
unsigned int bit08: 1;
unsigned int bit09: 1;
unsigned int bit0A: 1;
unsigned int bit0B: 1;
unsigned int bit0C: 1;
unsigned int bit0D: 1;
unsigned int bit0E: 1;
unsigned int bit0F: 1;
unsigned int bit10: 1;
unsigned int bit11: 1;
unsigned int bit12: 1;
unsigned int bit13: 1;
unsigned int bit14: 1;
unsigned int bit15: 1;
unsigned int bit16: 1;
unsigned int bit17: 1;
unsigned int bit18: 1;
unsigned int bit19: 1;
unsigned int bit1A: 1;
unsigned int bit1B: 1;
unsigned int bit1C: 1;
unsigned int bit1D: 1;
unsigned int bit1E: 1;
unsigned int bit1F: 1;
} bit;
struct
{
unsigned int quad_0 :4;
unsigned int quad_1 :4;
unsigned int quad_2 :4;
unsigned int quad_3 :4;
unsigned int quad_4 :4;
unsigned int quad_5 :4;
unsigned int quad_6 :4;
unsigned int quad_7 :4;
} qua;
struct
{
unsigned int byte_0 :8;
unsigned int byte_1 :8;
unsigned int byte_2 :8;
unsigned int byte_3 :8;
} byt;
struct
{
unsigned int word_0 :16;
unsigned int word_1 :16;
} wrd;
unsigned int all;
} LONGE;
#ifdef __cplusplus
}
#endif
#endif