123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- /* 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) 2023 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 "stdio.h"
- #include "string.h"
- #include "iap.h"
- /* USER CODE END Includes */
- /* Exported types ------------------------------------------------------------*/
- /* USER CODE BEGIN ET */
- #define iap_ 1
- #if 1
- #define IR_ROM1 0x08000000
- #else
- #define IR_ROM1 0x08020000
- #endif
- /* USER CODE END ET */
- /* Exported constants --------------------------------------------------------*/
- /* USER CODE BEGIN EC */
- /* USER CODE END EC */
- /* Exported macro ------------------------------------------------------------*/
- /* USER CODE BEGIN EM */
- extern uint16_t initial_address;
- extern int nameLength;
- extern int sizeLength ;
- extern int md5Length;
- extern uint32_t System_version;
- // ¶¨ÒåÊý×é´óС
- #define ARRAY_SIZE 1024
- /* USER CODE END EM */
- /* Exported functions prototypes ---------------------------------------------*/
- void Error_Handler(void);
- /* USER CODE BEGIN EFP */
- uint16_t read_flash_16(uint32_t addr);
- void read_new_address(uint32_t addr);
- void Write_Information(uint32_t addr, uint8_t* rx_buffer, uint8_t buffer_index);
- void ModBus(void);
- void receive_modbus_9_1(uint16_t addr, uint8_t funcode, uint16_t startaddr, uint16_t reg, uint8_t byteNum);
- void receive_modbus_4(uint16_t addr, uint8_t funcode);
- void clear_buf(void);
- void erase_flash(uint32_t ADDR_FLASH);
- uint32_t read_flash_32(uint32_t addr);
- /* USER CODE END EFP */
- /* Private defines -----------------------------------------------------------*/
- /* USER CODE BEGIN Private defines */
- #define FILTER_LENGTH 10
- #define DEBOUNCE_COUNT 10
- #define Modbus 1
- #define addr_FLASH_ADDR ((uint32_t)0x8070000) // address
- #define pbstatus_FLASH_ADDR ((uint32_t)0x8070800) // PbStatus
- #define baudrate_FLASH_ADDR ((uint32_t)0x8071000) // Baudrate
- #define ADC1_FLASH_ADDR ((uint32_t)0x8071800) // Adc2_Calibration 4-20mA
- #define ADC2_FLASH_ADDR ((uint32_t)0x8072000) // Adc3_Calibration 4-20mA
- #define SYSVERSION_ADDR ((uint32_t)0x8072800)
- #define CURPACKAGE_ADDR ((uint32_t)0x8073000)
- #define CURADDRESS_ADDR ((uint32_t)0x8073800)
- #define VERSION_ADDR ((uint32_t)0x8074000)
- #define LENGTH_ADDR ((uint32_t)0x8074800)
- #define MD5_ADDR ((uint32_t)0x8075000)
-
- /* USER CODE END Private defines */
- #ifdef __cplusplus
- }
- #endif
- #endif /* __MAIN_H */
|