Initial commit
This commit is contained in:
committed by
Tenocha
parent
02b570a41c
commit
3173e999aa
36
Core/Inc/boot_project_setup.h
Normal file
36
Core/Inc/boot_project_setup.h
Normal file
@@ -0,0 +1,36 @@
|
||||
// BOOTLOADER defines
|
||||
|
||||
// RCC defines
|
||||
#define __RCC_UART_BOOT_CLK_ENABLE() __HAL_RCC_USART3_CLK_ENABLE()
|
||||
#define __RCC_UART_PORT_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
|
||||
#define __RCC_DMA_UART_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE()
|
||||
#define __RCC_DMA_SDIO_CLK_ENABLE() __HAL_RCC_DMA2_CLK_ENABLE()
|
||||
#define __RCC_TIM_BOOT_CLK_ENABLE() __HAL_RCC_TIM7_CLK_ENABLE()
|
||||
|
||||
|
||||
// USART defines
|
||||
#define UART_BOOT USART3 // usart
|
||||
#define UART_SPEED 256000
|
||||
#define UART_BOOT_IRQn USART3_IRQn
|
||||
|
||||
#define UART_PORT GPIOB // usart port
|
||||
#define UART_PIN_TX GPIO_PIN_10
|
||||
#define UART_PIN_RX GPIO_PIN_11
|
||||
|
||||
|
||||
// DMA defines
|
||||
#define DMA_UART_Channel DMA1_Channel3
|
||||
#define DMA_SDIO_Channel DMA2_Channel4
|
||||
#define DMA_UART_IRQn DMA1_Channel3_IRQn
|
||||
#define DMA_SDIO_IRQn DMA2_Channel4_5_IRQn
|
||||
|
||||
// TIM defines
|
||||
#define TIM_BOOT TIM7
|
||||
#define TIM_BOOT_Prescaler 64000 // set up for 1 tick - 1 ms (no decrement needed)
|
||||
#define TIM_BOOT_IRQn TIM7_IRQn
|
||||
|
||||
// SDIO defines
|
||||
#define SDIO_SDCard_In_PORT GPIOB
|
||||
#define SDIO_SDCard_In_PIN GPIO_PIN_5
|
||||
#define SDIO_SDCard_In_IRQn EXTI9_5_IRQn
|
||||
|
||||
90
Core/Inc/bootloader.h
Normal file
90
Core/Inc/bootloader.h
Normal file
@@ -0,0 +1,90 @@
|
||||
#include "main.h"
|
||||
|
||||
#include "usart.h"
|
||||
#include "dma.h"
|
||||
#include "tim.h"
|
||||
#include "custom_flash.h"
|
||||
#include "gpio.h"
|
||||
#include "can.h"
|
||||
#include "sdio.h"
|
||||
#include "fatfs.h"
|
||||
|
||||
|
||||
// KEY defines
|
||||
#define BOOTLOADER_KEY_ADR (uint32_t)0x08009800
|
||||
#define BOOTLOADER_KEY_PAGE 20
|
||||
#define BL_KEY_APP_WRITTEN 0xAAAA5555
|
||||
|
||||
// MAIN APP defines
|
||||
#define MAIN_APP_START_ADR (uint32_t)0x0800C000
|
||||
#define MAIN_APP_PAGE 21
|
||||
#define MAIN_APP_NUM_OF_PAGE 250-MAIN_APP_PAGE
|
||||
|
||||
// ERROR DEFINES
|
||||
|
||||
|
||||
|
||||
struct flag
|
||||
{
|
||||
unsigned reInitMCU:1; // флаг перепрошивки (очишает память перед прошивкой новой)
|
||||
unsigned InitOrWait:1; // флаг активной прошивки (1) или ожидания комманды UART/CAN (0)
|
||||
unsigned StartInit:1; // флаг что необходимо начать прием прошивки/прошивку
|
||||
unsigned InitBootPeriph:1;// флаг старта инициализации перифирии для прошивки
|
||||
unsigned BootloaderCMD:3; // комманда: интерфейс для прошивки
|
||||
unsigned InitMCUReady:1; // окончание прошивки
|
||||
unsigned HalfOfWrite:1; // какая половина из dma буфера не записана
|
||||
|
||||
|
||||
unsigned SDCardIn:1;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct Bootloader_Errors
|
||||
{
|
||||
unsigned FLASH_ERASE:1;
|
||||
unsigned FLASH_WRITE:1;
|
||||
|
||||
unsigned CMD_INVALID:1;
|
||||
unsigned USART_RECEIVE:1;
|
||||
|
||||
|
||||
#ifdef __CAN_H__
|
||||
unsigned CAN:1;
|
||||
#endif
|
||||
|
||||
#ifdef __SDIO_H__
|
||||
unsigned SD_CARD_NOT_INSERTED:1;
|
||||
unsigned SD_CARD_READ:1;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct Bootloader_Errors_Counters
|
||||
{
|
||||
unsigned FLASH_ERASE;
|
||||
unsigned FLASH_WRITE;
|
||||
|
||||
unsigned CMD_INVALID;
|
||||
unsigned USART_RECEIVE;
|
||||
|
||||
#ifdef __CAN_H__
|
||||
unsigned CAN_RECEIVE;
|
||||
#endif
|
||||
#ifdef __SDIO_H__
|
||||
unsigned SD_CARD_NOT_INSERTED;
|
||||
unsigned SD_CARD_READ;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
void Bootloader_main(void);
|
||||
|
||||
void SD_Programming(FRESULT *res_fresult, HAL_StatusTypeDef *res_hal);
|
||||
void Bootloader_TIM_Handler(void); // handler for "WD" Timer
|
||||
void Check_CMD_USART(uint8_t *DataUART);
|
||||
void SetKey(void);
|
||||
uint32_t ReadKey(void);
|
||||
void ResetKey(void);
|
||||
void Boot_SystemClock_Config(void);
|
||||
52
Core/Inc/can.h
Normal file
52
Core/Inc/can.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file can.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the can.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __CAN_H__
|
||||
#define __CAN_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
extern CAN_HandleTypeDef hcan;
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_CAN_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CAN_H__ */
|
||||
|
||||
9
Core/Inc/custom_flash.h
Normal file
9
Core/Inc/custom_flash.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "main.h"
|
||||
|
||||
#define PAGE_SIZE 2048
|
||||
|
||||
|
||||
HAL_StatusTypeDef FLASH_Write_Page(uint32_t *Address, uint8_t *Data, int Data_size);
|
||||
HAL_StatusTypeDef FLASH_Write_Word(uint32_t Address, uint64_t Data);
|
||||
HAL_StatusTypeDef FLASH_Erase_App(void);
|
||||
uint8_t *FLASH_Read(uint32_t add);
|
||||
20
Core/Inc/custom_receive_and_write.h
Normal file
20
Core/Inc/custom_receive_and_write.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "main.h"
|
||||
#include "ff.h"
|
||||
|
||||
//#include "usart.h"
|
||||
#define sizebuff 16
|
||||
struct flags
|
||||
{
|
||||
unsigned writting:1;
|
||||
};
|
||||
|
||||
extern struct flags flags_UART_FATFS;
|
||||
|
||||
FRESULT CreateAndOpenMessageFile(FIL *MessageFile, const TCHAR* path);
|
||||
FRESULT OpenMessageFile(FIL *MessageFile, const TCHAR* path);
|
||||
FRESULT WriteMessage(FIL *MessageFile, char *Message, UINT SizeOfMessage);
|
||||
FRESULT CloseMessageFile(FIL *MessageFile);
|
||||
void WriteFile(char *Data, int Num_of_Data);
|
||||
|
||||
void Check_USART(void);
|
||||
|
||||
20
Core/Inc/custom_usart.h
Normal file
20
Core/Inc/custom_usart.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "main.h"
|
||||
|
||||
#define __USER_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
|
||||
do{ \
|
||||
(__HANDLE__)->__PPP_DMA_FIELD__ = (__DMA_HANDLE__); \
|
||||
(__DMA_HANDLE__)->Parent = (__HANDLE__);} while(0U)
|
||||
|
||||
struct UARTSettings
|
||||
{
|
||||
USART_TypeDef *UARTx;
|
||||
uint32_t UART_Speed;
|
||||
GPIO_TypeDef *GPIOx;
|
||||
uint16_t GPIO_PIN_RX;
|
||||
uint16_t GPIO_PIN_TX;
|
||||
DMA_Channel_TypeDef *DMAChannel; // DMAChannel = 0 if doesnt need
|
||||
};
|
||||
|
||||
void User_UART_Init(UART_HandleTypeDef* huart, DMA_HandleTypeDef *DMAhuart, struct UARTSettings *uuart);
|
||||
void UART_GPIO_Init(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN_RX, uint16_t GPIO_PIN_TX);
|
||||
void UART_DMA_Init(UART_HandleTypeDef *huart, DMA_HandleTypeDef *hdma_rx, DMA_Channel_TypeDef *DMAhuart);
|
||||
52
Core/Inc/dma.h
Normal file
52
Core/Inc/dma.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file dma.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the dma.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __DMA_H__
|
||||
#define __DMA_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* DMA memory to memory transfer handles -------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_DMA_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __DMA_H__ */
|
||||
|
||||
49
Core/Inc/gpio.h
Normal file
49
Core/Inc/gpio.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file gpio.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the gpio.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __GPIO_H__
|
||||
#define __GPIO_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_GPIO_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /*__ GPIO_H__ */
|
||||
|
||||
71
Core/Inc/main.h
Normal file
71
Core/Inc/main.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : main.h
|
||||
* @brief : Header for main.c file.
|
||||
* This file contains the common defines of the application.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __MAIN_H
|
||||
#define __MAIN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f1xx_hal.h"
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
#include "boot_project_setup.h"
|
||||
#include "requester.h"
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ET */
|
||||
|
||||
/* USER CODE END ET */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EC */
|
||||
|
||||
/* USER CODE END EC */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EM */
|
||||
|
||||
/* USER CODE END EM */
|
||||
|
||||
/* Exported functions prototypes ---------------------------------------------*/
|
||||
void Error_Handler(void);
|
||||
void SystemClock_Config(void);
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
/* Private defines -----------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MAIN_H */
|
||||
224
Core/Inc/requester.h
Normal file
224
Core/Inc/requester.h
Normal file
@@ -0,0 +1,224 @@
|
||||
#ifndef _requester
|
||||
#define _requester
|
||||
#include "main.h"
|
||||
#include "can.h"
|
||||
#include "rtc.h"
|
||||
#include "tim.h"
|
||||
|
||||
#define _DEMO
|
||||
|
||||
#define ONLINE 1;
|
||||
#define OFFLINE 0;
|
||||
|
||||
#define TIM_REQUESTER_Prescaler 64000
|
||||
|
||||
//CAN Filter
|
||||
#define ID_MAIN_DEVICE 0x000
|
||||
#define CURRENT_ID_DEVICE 0x002
|
||||
#define CAN_IDE_32 0b00000100 // Для 32-х битного масштаба
|
||||
|
||||
#define CAN_DATA_TYPE_FILTER 0x1F000000
|
||||
#define CAN_DEVICE_ID_FILTER 0x000000FF
|
||||
#define CAN_SENSOR_TYPE_FILTER 0x00F80000
|
||||
#define CAN_SENSOR_ID_FILTER 0x0007FF00
|
||||
|
||||
|
||||
void REQUESTER_Init(void);
|
||||
void REQUESTER_MainWhile(void);
|
||||
void Boot_SystemClock_Config(void);
|
||||
void REQUESTER_AnalogProcessing(void);
|
||||
void REQUESTER_BroadcastProcessing(void);
|
||||
void REQUESTER_DiscreticProcessing(void);
|
||||
void REQUESTER_ModbusProcessing(void);
|
||||
void REQUESTER_RTC_SYNC(uint8_t *data);
|
||||
void REQUESTER_Pulse_TIM_Handler(void);
|
||||
void Boot_SystemClock_Config(void);
|
||||
void REQUESTER_CAN_FILTERS(void);
|
||||
|
||||
union Byte{
|
||||
struct bitfield{
|
||||
unsigned bit0:1;
|
||||
unsigned bit1:1;
|
||||
unsigned bit2:1;
|
||||
unsigned bit3:1;
|
||||
unsigned bit4:1;
|
||||
unsigned bit5:1;
|
||||
unsigned bit6:1;
|
||||
unsigned bit7:1;
|
||||
}Bitfield;
|
||||
char AllBit;
|
||||
};
|
||||
|
||||
_Bool IsLeapYear(uint8_t year);
|
||||
|
||||
#define COUNT_OF_MODBUS_SECTIONS 1
|
||||
#define MODBUS_SECTION_MASK 0
|
||||
#define MODBUS_SECTION_FILTER 1
|
||||
|
||||
#define SensorToModbusRegister(SensorType, SensorID) SensorType << 11 | SensorID
|
||||
#define HighByteOfWord(WORD) (WORD>>8)&0xFF
|
||||
#define LowByteOfWord(WORD) WORD&0xFF
|
||||
|
||||
//Route mode
|
||||
#define ROUTE_MASTER 0
|
||||
#define ROUTE_SLAVE 1
|
||||
|
||||
//Data Types
|
||||
#define DATA_TYPE_BROADCAST 0b0000
|
||||
#define DATA_TYPE_DISCRETE 0b0001
|
||||
#define DATA_TYPE_ANALOG 0b0010
|
||||
#define DATA_TYPE_MODBUS_COIL 0b0011
|
||||
#define DATA_TYPE_MODBUS_DISCRETE 0b0100
|
||||
#define DATA_TYPE_MODBUS_HOLDING 0b0101
|
||||
#define DATA_TYPE_MODBUS_INPUT 0b0110
|
||||
#define DATA_TYPE_ERROR 0b0111
|
||||
#define DATA_TYPE_PULSE 0b1111
|
||||
|
||||
//Sensor Types for DATA_TYPE_BROADCAST
|
||||
#define SENSOR_TYPE_STATUS 0b00000
|
||||
#define SENSOR_TYPE_ONOFF 0b00001
|
||||
#define SENSOR_TYPE_RTCSETUP 0b00010
|
||||
|
||||
//Sensor Types for DATA_TYPE_DISCRETE
|
||||
#define SENSOR_TYPE_ACCIDENT 0b00000
|
||||
#define SENSOR_TYPE_WARNING 0b00001
|
||||
#define SENSOR_TYPE_CONTROL_SIGNALS 0b00010
|
||||
#define SENSOR_TYPE_FLAGS 0b00011
|
||||
#define SENSOR_TYPE_RESET 0b00100
|
||||
#define SENSOR_TYPE_CHANGE_MODE 0b00101
|
||||
#define SENSOR_TYPE_REQUEST_LIST_OF_PARAMETERS 0b00110
|
||||
|
||||
//Sensor Types for DATA_TYPE_ANALOG
|
||||
#define SENSOR_TYPE_UNIVERSAL 0b00000
|
||||
#define SENSOR_TYPE_U 0b00001
|
||||
#define SENSOR_TYPE_I 0b00010
|
||||
#define SENSOR_TYPE_T 0b00011
|
||||
|
||||
//Error Code
|
||||
#define NONEXISTENT_ELEMENT 0x01
|
||||
|
||||
#define HighIdFilter(x) x<<24
|
||||
|
||||
|
||||
struct controlflags{
|
||||
unsigned IsPulse:1;
|
||||
unsigned IsRtrMode:1;
|
||||
};
|
||||
|
||||
//Device settings
|
||||
union ext_ID{
|
||||
struct ext_ID_fields{
|
||||
unsigned DeviceID:8;
|
||||
unsigned SensorID:11;
|
||||
unsigned SensorType:5;
|
||||
unsigned DataType:4;
|
||||
unsigned Route:1;
|
||||
}Fields;
|
||||
unsigned int BitAll:29;
|
||||
};
|
||||
|
||||
union ext_ID_Modbus{
|
||||
struct ext_ID_Modbus_fields{
|
||||
unsigned DeviceID:8;
|
||||
unsigned CountReg:8;
|
||||
unsigned StrAdr:8;
|
||||
unsigned DataType:4;
|
||||
unsigned Route;
|
||||
}Fields;
|
||||
unsigned int BitAll:29;
|
||||
};
|
||||
|
||||
struct device
|
||||
{
|
||||
unsigned Status:1;
|
||||
union ext_ID ExtID;
|
||||
unsigned TimeFromLastPulse;
|
||||
unsigned LastPulseStep;
|
||||
};
|
||||
|
||||
struct data
|
||||
{
|
||||
struct T_sens{
|
||||
char info[256];
|
||||
unsigned SensID;
|
||||
unsigned AvrgValue;
|
||||
unsigned LastTenValues[10];
|
||||
}TS;
|
||||
|
||||
struct U_sens{
|
||||
char info[256];
|
||||
unsigned SensID;
|
||||
unsigned AvrgValue;
|
||||
unsigned LastTenValues[10];
|
||||
}Uu, Uv, Uw;
|
||||
|
||||
struct I_sens{
|
||||
char info[256];
|
||||
unsigned SensID;
|
||||
unsigned AvrgValue;
|
||||
unsigned LastTenValues[10];
|
||||
}Iu, Iv, Iw;
|
||||
};
|
||||
|
||||
struct received_request{
|
||||
union ext_ID RequestedExtID;
|
||||
unsigned RequestedDLC;
|
||||
uint8_t RxData[8];
|
||||
|
||||
//DATA_TYPE_DISCRETIC
|
||||
union discreticflags{
|
||||
struct discretictype{
|
||||
unsigned Request_Accident:1;
|
||||
unsigned Request_Warning:1;
|
||||
unsigned Request_Control_Signals:1;
|
||||
unsigned Request_Flags:1;
|
||||
unsigned Request_Reset:1;
|
||||
unsigned Request_List_of_Parameters:1;
|
||||
}DiscreticType;
|
||||
unsigned AllFlags:5;
|
||||
}DiscreticFlags;
|
||||
|
||||
//DATA_TYPE_BROADCAST
|
||||
union broadcastflags{
|
||||
struct broadcasttype{
|
||||
unsigned Request_Status:1;
|
||||
unsigned Request_OnOff:1;
|
||||
unsigned Request_RTC_Setup:1;
|
||||
}BroadcastType;
|
||||
unsigned AllFlags:3;
|
||||
}BroadcastFlags;
|
||||
|
||||
//DATA_TYPE_ANALOG
|
||||
union analogflags{
|
||||
struct analogtype{
|
||||
unsigned Request_Universal_Sens:1;
|
||||
unsigned Request_U_Sens:1;
|
||||
unsigned Request_I_Sens:1;
|
||||
unsigned Request_T_Sens:1;
|
||||
}AnalogType;
|
||||
unsigned AllFlags:4;
|
||||
}AnalogFlags;
|
||||
|
||||
//DATA_TYPE_MODBUS
|
||||
union modbusflags{
|
||||
struct modbustype{
|
||||
unsigned Coil:1;
|
||||
unsigned Discrete:1;
|
||||
unsigned Holding:1;
|
||||
unsigned Input:1;
|
||||
}ModbusType;
|
||||
unsigned AllFlags:4;
|
||||
}ModbusFlags;
|
||||
|
||||
union sensor_To_Modbus{
|
||||
struct modbus{
|
||||
unsigned Count:8;
|
||||
unsigned StrAdr:8;
|
||||
}Modbus;
|
||||
unsigned Sensor:16;
|
||||
}SensorToModbus;
|
||||
|
||||
unsigned ModbusFlag:1;
|
||||
};
|
||||
|
||||
#endif
|
||||
52
Core/Inc/rtc.h
Normal file
52
Core/Inc/rtc.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file rtc.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the rtc.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __RTC_H__
|
||||
#define __RTC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
extern RTC_HandleTypeDef hrtc;
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_RTC_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __RTC_H__ */
|
||||
|
||||
52
Core/Inc/sdio.h
Normal file
52
Core/Inc/sdio.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file sdio.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the sdio.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __SDIO_H__
|
||||
#define __SDIO_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
extern SD_HandleTypeDef hsd;
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_SDIO_SD_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SDIO_H__ */
|
||||
|
||||
391
Core/Inc/stm32f1xx_hal_conf.h
Normal file
391
Core/Inc/stm32f1xx_hal_conf.h
Normal file
@@ -0,0 +1,391 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f1xx_hal_conf.h
|
||||
* @brief HAL configuration file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F1xx_HAL_CONF_H
|
||||
#define __STM32F1xx_HAL_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
/* ########################## Module Selection ############################## */
|
||||
/**
|
||||
* @brief This is the list of modules to be used in the HAL driver
|
||||
*/
|
||||
|
||||
#define HAL_MODULE_ENABLED
|
||||
/*#define HAL_ADC_MODULE_ENABLED */
|
||||
/*#define HAL_CRYP_MODULE_ENABLED */
|
||||
#define HAL_CAN_MODULE_ENABLED
|
||||
/*#define HAL_CAN_LEGACY_MODULE_ENABLED */
|
||||
/*#define HAL_CEC_MODULE_ENABLED */
|
||||
/*#define HAL_CORTEX_MODULE_ENABLED */
|
||||
/*#define HAL_CRC_MODULE_ENABLED */
|
||||
/*#define HAL_DAC_MODULE_ENABLED */
|
||||
#define HAL_DMA_MODULE_ENABLED
|
||||
/*#define HAL_ETH_MODULE_ENABLED */
|
||||
/*#define HAL_FLASH_MODULE_ENABLED */
|
||||
#define HAL_GPIO_MODULE_ENABLED
|
||||
/*#define HAL_I2C_MODULE_ENABLED */
|
||||
/*#define HAL_I2S_MODULE_ENABLED */
|
||||
/*#define HAL_IRDA_MODULE_ENABLED */
|
||||
/*#define HAL_IWDG_MODULE_ENABLED */
|
||||
/*#define HAL_NOR_MODULE_ENABLED */
|
||||
/*#define HAL_NAND_MODULE_ENABLED */
|
||||
/*#define HAL_PCCARD_MODULE_ENABLED */
|
||||
/*#define HAL_PCD_MODULE_ENABLED */
|
||||
/*#define HAL_HCD_MODULE_ENABLED */
|
||||
/*#define HAL_PWR_MODULE_ENABLED */
|
||||
/*#define HAL_RCC_MODULE_ENABLED */
|
||||
#define HAL_RTC_MODULE_ENABLED
|
||||
#define HAL_SD_MODULE_ENABLED
|
||||
/*#define HAL_MMC_MODULE_ENABLED */
|
||||
/*#define HAL_SDRAM_MODULE_ENABLED */
|
||||
/*#define HAL_SMARTCARD_MODULE_ENABLED */
|
||||
/*#define HAL_SPI_MODULE_ENABLED */
|
||||
/*#define HAL_SRAM_MODULE_ENABLED */
|
||||
#define HAL_TIM_MODULE_ENABLED
|
||||
#define HAL_UART_MODULE_ENABLED
|
||||
/*#define HAL_USART_MODULE_ENABLED */
|
||||
/*#define HAL_WWDG_MODULE_ENABLED */
|
||||
|
||||
#define HAL_CORTEX_MODULE_ENABLED
|
||||
#define HAL_DMA_MODULE_ENABLED
|
||||
#define HAL_FLASH_MODULE_ENABLED
|
||||
#define HAL_EXTI_MODULE_ENABLED
|
||||
#define HAL_GPIO_MODULE_ENABLED
|
||||
#define HAL_PWR_MODULE_ENABLED
|
||||
#define HAL_RCC_MODULE_ENABLED
|
||||
|
||||
/* ########################## Oscillator Values adaptation ####################*/
|
||||
/**
|
||||
* @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
|
||||
* This value is used by the RCC HAL module to compute the system frequency
|
||||
* (when HSE is used as system clock source, directly or through the PLL).
|
||||
*/
|
||||
#if !defined (HSE_VALUE)
|
||||
#define HSE_VALUE 8000000U /*!< Value of the External oscillator in Hz */
|
||||
#endif /* HSE_VALUE */
|
||||
|
||||
#if !defined (HSE_STARTUP_TIMEOUT)
|
||||
#define HSE_STARTUP_TIMEOUT 100U /*!< Time out for HSE start up, in ms */
|
||||
#endif /* HSE_STARTUP_TIMEOUT */
|
||||
|
||||
/**
|
||||
* @brief Internal High Speed oscillator (HSI) value.
|
||||
* This value is used by the RCC HAL module to compute the system frequency
|
||||
* (when HSI is used as system clock source, directly or through the PLL).
|
||||
*/
|
||||
#if !defined (HSI_VALUE)
|
||||
#define HSI_VALUE 8000000U /*!< Value of the Internal oscillator in Hz*/
|
||||
#endif /* HSI_VALUE */
|
||||
|
||||
/**
|
||||
* @brief Internal Low Speed oscillator (LSI) value.
|
||||
*/
|
||||
#if !defined (LSI_VALUE)
|
||||
#define LSI_VALUE 40000U /*!< LSI Typical Value in Hz */
|
||||
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
|
||||
The real value may vary depending on the variations
|
||||
in voltage and temperature. */
|
||||
|
||||
/**
|
||||
* @brief External Low Speed oscillator (LSE) value.
|
||||
* This value is used by the UART, RTC HAL module to compute the system frequency
|
||||
*/
|
||||
#if !defined (LSE_VALUE)
|
||||
#define LSE_VALUE 32768U /*!< Value of the External oscillator in Hz*/
|
||||
#endif /* LSE_VALUE */
|
||||
|
||||
#if !defined (LSE_STARTUP_TIMEOUT)
|
||||
#define LSE_STARTUP_TIMEOUT 5000U /*!< Time out for LSE start up, in ms */
|
||||
#endif /* LSE_STARTUP_TIMEOUT */
|
||||
|
||||
/* Tip: To avoid modifying this file each time you need to use different HSE,
|
||||
=== you can define the HSE value in your toolchain compiler preprocessor. */
|
||||
|
||||
/* ########################### System Configuration ######################### */
|
||||
/**
|
||||
* @brief This is the HAL system configuration section
|
||||
*/
|
||||
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
|
||||
#define TICK_INT_PRIORITY 15U /*!< tick interrupt priority (lowest by default) */
|
||||
#define USE_RTOS 0U
|
||||
#define PREFETCH_ENABLE 1U
|
||||
|
||||
#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */
|
||||
#define USE_HAL_CAN_REGISTER_CALLBACKS 0U /* CAN register callback disabled */
|
||||
#define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC register callback disabled */
|
||||
#define USE_HAL_DAC_REGISTER_CALLBACKS 0U /* DAC register callback disabled */
|
||||
#define USE_HAL_ETH_REGISTER_CALLBACKS 0U /* ETH register callback disabled */
|
||||
#define USE_HAL_HCD_REGISTER_CALLBACKS 0U /* HCD register callback disabled */
|
||||
#define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */
|
||||
#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */
|
||||
#define USE_HAL_MMC_REGISTER_CALLBACKS 0U /* MMC register callback disabled */
|
||||
#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */
|
||||
#define USE_HAL_NOR_REGISTER_CALLBACKS 0U /* NOR register callback disabled */
|
||||
#define USE_HAL_PCCARD_REGISTER_CALLBACKS 0U /* PCCARD register callback disabled */
|
||||
#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */
|
||||
#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */
|
||||
#define USE_HAL_SD_REGISTER_CALLBACKS 0U /* SD register callback disabled */
|
||||
#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */
|
||||
#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */
|
||||
#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U /* SRAM register callback disabled */
|
||||
#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */
|
||||
#define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */
|
||||
#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */
|
||||
#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */
|
||||
#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */
|
||||
|
||||
/* ########################## Assert Selection ############################## */
|
||||
/**
|
||||
* @brief Uncomment the line below to expanse the "assert_param" macro in the
|
||||
* HAL drivers code
|
||||
*/
|
||||
/* #define USE_FULL_ASSERT 1U */
|
||||
|
||||
/* ################## Ethernet peripheral configuration ##################### */
|
||||
|
||||
/* Section 1 : Ethernet peripheral configuration */
|
||||
|
||||
/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
|
||||
#define MAC_ADDR0 2U
|
||||
#define MAC_ADDR1 0U
|
||||
#define MAC_ADDR2 0U
|
||||
#define MAC_ADDR3 0U
|
||||
#define MAC_ADDR4 0U
|
||||
#define MAC_ADDR5 0U
|
||||
|
||||
/* Definition of the Ethernet driver buffers size and count */
|
||||
#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
|
||||
#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
|
||||
#define ETH_RXBUFNB 8U /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
|
||||
#define ETH_TXBUFNB 4U /* 4 Tx buffers of size ETH_TX_BUF_SIZE */
|
||||
|
||||
/* Section 2: PHY configuration section */
|
||||
|
||||
/* DP83848_PHY_ADDRESS Address*/
|
||||
#define DP83848_PHY_ADDRESS 0x01U
|
||||
/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
|
||||
#define PHY_RESET_DELAY 0x000000FFU
|
||||
/* PHY Configuration delay */
|
||||
#define PHY_CONFIG_DELAY 0x00000FFFU
|
||||
|
||||
#define PHY_READ_TO 0x0000FFFFU
|
||||
#define PHY_WRITE_TO 0x0000FFFFU
|
||||
|
||||
/* Section 3: Common PHY Registers */
|
||||
|
||||
#define PHY_BCR ((uint16_t)0x00) /*!< Transceiver Basic Control Register */
|
||||
#define PHY_BSR ((uint16_t)0x01) /*!< Transceiver Basic Status Register */
|
||||
|
||||
#define PHY_RESET ((uint16_t)0x8000) /*!< PHY Reset */
|
||||
#define PHY_LOOPBACK ((uint16_t)0x4000) /*!< Select loop-back mode */
|
||||
#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */
|
||||
#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */
|
||||
#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */
|
||||
#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */
|
||||
#define PHY_AUTONEGOTIATION ((uint16_t)0x1000) /*!< Enable auto-negotiation function */
|
||||
#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200) /*!< Restart auto-negotiation function */
|
||||
#define PHY_POWERDOWN ((uint16_t)0x0800) /*!< Select the power down mode */
|
||||
#define PHY_ISOLATE ((uint16_t)0x0400) /*!< Isolate PHY from MII */
|
||||
|
||||
#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020) /*!< Auto-Negotiation process completed */
|
||||
#define PHY_LINKED_STATUS ((uint16_t)0x0004) /*!< Valid link established */
|
||||
#define PHY_JABBER_DETECTION ((uint16_t)0x0002) /*!< Jabber condition detected */
|
||||
|
||||
/* Section 4: Extended PHY Registers */
|
||||
#define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */
|
||||
|
||||
#define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */
|
||||
#define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */
|
||||
|
||||
/* ################## SPI peripheral configuration ########################## */
|
||||
|
||||
/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
|
||||
* Activated: CRC code is present inside driver
|
||||
* Deactivated: CRC code cleaned from driver
|
||||
*/
|
||||
|
||||
#define USE_SPI_CRC 0U
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief Include module's header file
|
||||
*/
|
||||
|
||||
#ifdef HAL_RCC_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_rcc.h"
|
||||
#endif /* HAL_RCC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_GPIO_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_gpio.h"
|
||||
#endif /* HAL_GPIO_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_EXTI_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_exti.h"
|
||||
#endif /* HAL_EXTI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DMA_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_dma.h"
|
||||
#endif /* HAL_DMA_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_ETH_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_eth.h"
|
||||
#endif /* HAL_ETH_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CAN_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_can.h"
|
||||
#endif /* HAL_CAN_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CAN_LEGACY_MODULE_ENABLED
|
||||
#include "Legacy/stm32f1xx_hal_can_legacy.h"
|
||||
#endif /* HAL_CAN_LEGACY_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CEC_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_cec.h"
|
||||
#endif /* HAL_CEC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CORTEX_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_cortex.h"
|
||||
#endif /* HAL_CORTEX_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_ADC_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_adc.h"
|
||||
#endif /* HAL_ADC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CRC_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_crc.h"
|
||||
#endif /* HAL_CRC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DAC_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_dac.h"
|
||||
#endif /* HAL_DAC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_FLASH_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_flash.h"
|
||||
#endif /* HAL_FLASH_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SRAM_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_sram.h"
|
||||
#endif /* HAL_SRAM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_NOR_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_nor.h"
|
||||
#endif /* HAL_NOR_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_I2C_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_i2c.h"
|
||||
#endif /* HAL_I2C_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_I2S_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_i2s.h"
|
||||
#endif /* HAL_I2S_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_IWDG_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_iwdg.h"
|
||||
#endif /* HAL_IWDG_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_PWR_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_pwr.h"
|
||||
#endif /* HAL_PWR_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_RTC_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_rtc.h"
|
||||
#endif /* HAL_RTC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_PCCARD_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_pccard.h"
|
||||
#endif /* HAL_PCCARD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SD_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_sd.h"
|
||||
#endif /* HAL_SD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_NAND_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_nand.h"
|
||||
#endif /* HAL_NAND_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SPI_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_spi.h"
|
||||
#endif /* HAL_SPI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_TIM_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_tim.h"
|
||||
#endif /* HAL_TIM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_UART_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_uart.h"
|
||||
#endif /* HAL_UART_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_USART_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_usart.h"
|
||||
#endif /* HAL_USART_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_IRDA_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_irda.h"
|
||||
#endif /* HAL_IRDA_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SMARTCARD_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_smartcard.h"
|
||||
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_WWDG_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_wwdg.h"
|
||||
#endif /* HAL_WWDG_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_PCD_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_pcd.h"
|
||||
#endif /* HAL_PCD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_HCD_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_hcd.h"
|
||||
#endif /* HAL_HCD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_MMC_MODULE_ENABLED
|
||||
#include "stm32f1xx_hal_mmc.h"
|
||||
#endif /* HAL_MMC_MODULE_ENABLED */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
#ifdef USE_FULL_ASSERT
|
||||
/**
|
||||
* @brief The assert_param macro is used for function's parameters check.
|
||||
* @param expr If expr is false, it calls assert_failed function
|
||||
* which reports the name of the source file and the source
|
||||
* line number of the call that failed.
|
||||
* If expr is true, it returns no value.
|
||||
* @retval None
|
||||
*/
|
||||
#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
void assert_failed(uint8_t* file, uint32_t line);
|
||||
#else
|
||||
#define assert_param(expr) ((void)0U)
|
||||
#endif /* USE_FULL_ASSERT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32F1xx_HAL_CONF_H */
|
||||
|
||||
74
Core/Inc/stm32f1xx_it.h
Normal file
74
Core/Inc/stm32f1xx_it.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f1xx_it.h
|
||||
* @brief This file contains the headers of the interrupt handlers.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F1xx_IT_H
|
||||
#define __STM32F1xx_IT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ET */
|
||||
|
||||
/* USER CODE END ET */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EC */
|
||||
|
||||
/* USER CODE END EC */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EM */
|
||||
|
||||
/* USER CODE END EM */
|
||||
|
||||
/* Exported functions prototypes ---------------------------------------------*/
|
||||
void NMI_Handler(void);
|
||||
void HardFault_Handler(void);
|
||||
void MemManage_Handler(void);
|
||||
void BusFault_Handler(void);
|
||||
void UsageFault_Handler(void);
|
||||
void SVC_Handler(void);
|
||||
void DebugMon_Handler(void);
|
||||
void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
void DMA1_Channel3_IRQHandler(void);
|
||||
void USB_HP_CAN1_TX_IRQHandler(void);
|
||||
void USB_LP_CAN1_RX0_IRQHandler(void);
|
||||
void CAN1_SCE_IRQHandler(void);
|
||||
void USART3_IRQHandler(void);
|
||||
void TIM8_UP_TIM13_IRQHandler(void);
|
||||
void TIM7_IRQHandler(void);
|
||||
void DMA2_Channel4_5_IRQHandler(void);
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32F1xx_IT_H */
|
||||
52
Core/Inc/tim.h
Normal file
52
Core/Inc/tim.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file tim.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the tim.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __TIM_H__
|
||||
#define __TIM_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
extern TIM_HandleTypeDef htim7;
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_TIM7_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __TIM_H__ */
|
||||
|
||||
52
Core/Inc/usart.h
Normal file
52
Core/Inc/usart.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file usart.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the usart.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __USART_H__
|
||||
#define __USART_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
//#include "custom_usart.h"
|
||||
/* USER CODE END Includes */
|
||||
|
||||
extern UART_HandleTypeDef huart3;
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_USART3_UART_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __USART_H__ */
|
||||
|
||||
Reference in New Issue
Block a user