166 lines
5.4 KiB
C
166 lines
5.4 KiB
C
/* USER CODE BEGIN Header */
|
||
/**
|
||
******************************************************************************
|
||
* @file : main.h
|
||
* @brief : Header for main.c file.
|
||
* This file contains the common defines of the application.
|
||
******************************************************************************
|
||
* @attention
|
||
*
|
||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||
* All rights reserved.</center></h2>
|
||
*
|
||
* This software component is licensed by ST under BSD 3-Clause license,
|
||
* the "License"; You may not use this file except in compliance with the
|
||
* License. You may obtain a copy of the License at:
|
||
* opensource.org/licenses/BSD-3-Clause
|
||
*
|
||
******************************************************************************
|
||
*/
|
||
/* USER CODE END Header */
|
||
|
||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||
#ifndef __MAIN_H
|
||
#define __MAIN_H
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
/* Includes ------------------------------------------------------------------*/
|
||
#include "stm32f1xx_ll_dma.h"
|
||
#include "stm32f1xx_ll_iwdg.h"
|
||
#include "stm32f1xx_ll_rcc.h"
|
||
#include "stm32f1xx_ll_bus.h"
|
||
#include "stm32f1xx_ll_system.h"
|
||
#include "stm32f1xx_ll_exti.h"
|
||
#include "stm32f1xx_ll_cortex.h"
|
||
#include "stm32f1xx_ll_utils.h"
|
||
#include "stm32f1xx_ll_pwr.h"
|
||
#include "stm32f1xx_ll_tim.h"
|
||
#include "stm32f1xx_ll_usart.h"
|
||
#include "stm32f1xx.h"
|
||
#include "stm32f1xx_ll_gpio.h"
|
||
|
||
#if defined(USE_FULL_ASSERT)
|
||
#include "stm32_assert.h"
|
||
#endif /* USE_FULL_ASSERT */
|
||
|
||
/* 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 Error_Handler(void);
|
||
|
||
/* USER CODE BEGIN EFP */
|
||
void Offline_Working(void);
|
||
void Reed_Working(void);
|
||
uint32_t MCU_UID(void);
|
||
/* USER CODE END EFP */
|
||
|
||
/* Private defines -----------------------------------------------------------*/
|
||
#define Reed_Switch_Pin LL_GPIO_PIN_4
|
||
#define Reed_Switch_GPIO_Port GPIOA
|
||
#define Reed_Switch_EXTI_IRQn EXTI4_IRQn
|
||
#ifndef NVIC_PRIORITYGROUP_0
|
||
#define NVIC_PRIORITYGROUP_0 ((uint32_t)0x00000007) /*!< 0 bit for pre-emption priority,
|
||
4 bits for subpriority */
|
||
#define NVIC_PRIORITYGROUP_1 ((uint32_t)0x00000006) /*!< 1 bit for pre-emption priority,
|
||
3 bits for subpriority */
|
||
#define NVIC_PRIORITYGROUP_2 ((uint32_t)0x00000005) /*!< 2 bits for pre-emption priority,
|
||
2 bits for subpriority */
|
||
#define NVIC_PRIORITYGROUP_3 ((uint32_t)0x00000004) /*!< 3 bits for pre-emption priority,
|
||
1 bit for subpriority */
|
||
#define NVIC_PRIORITYGROUP_4 ((uint32_t)0x00000003) /*!< 4 bits for pre-emption priority,
|
||
0 bit for subpriority */
|
||
#endif
|
||
/* USER CODE BEGIN Private defines */
|
||
//<2F><>λ<EFBFBD><CEBB>
|
||
#define Minimum_Period 60
|
||
//#define Max_Period 120
|
||
#define Max_Period 5
|
||
#define Radar_frame_len 36
|
||
|
||
#define senddataport 10U //STS_O1 SEND DATA PORT
|
||
#define sendhtbtport 5U //STS_O2 send heart beat port
|
||
#define cmdreplyport 13U // presence sensor parameter change feedback data port
|
||
|
||
enum Work_Mode {
|
||
Network_Mode =0,// Mode = 0, Network/Cloud control mode
|
||
Wired_Mode, // Mode = 1, Not used now
|
||
Reed_Mode, // Mode = 2, Reed Switch Mode or Hall Element
|
||
Radar_Mode, // Mode = 3, USART Radar mode
|
||
Reed_Radar_Dual_Mode // Mode = 4, Dual Mode of Reed and Radar
|
||
};
|
||
|
||
enum ReedSwitch_Status {
|
||
ReedSwitch_Open = 0, // Door/ReedSwitch/Holl Element Open
|
||
ReedSwitch_Close = 1 // Close Status
|
||
};
|
||
|
||
enum Presence_Status {
|
||
No_Occupancy = 0, // Not Occupancy, or Not presence
|
||
Occupancy = 1 // Occupancy or Presence
|
||
};
|
||
|
||
|
||
#define KeYong 0
|
||
#define ZhanYong 1
|
||
#define Close 0
|
||
#define Open 1
|
||
|
||
enum End_Node_Status {
|
||
Door_Open_No_Presence = 0, //Door Open, No Occupancy
|
||
Door_Open_Presence = 1, //Door Open, Occupancy
|
||
Door_Close_No_Presence =1, //Door Close, No Occupancy
|
||
Door_Close_Presence =1, //Door close, Occupancy
|
||
Door_Open = 0, // Door_open status Only
|
||
Door_Close =1, // Door_close Status only
|
||
No_Presence = 0, // Not Presence Only, no door status
|
||
Presence =1 // Presence Only, no door status
|
||
};
|
||
|
||
enum senddataconfirmation {
|
||
UnConfirmed = 0, // LoRa unconfirmed data upload
|
||
Confirmed // LoRa Confirmed data upload
|
||
};
|
||
|
||
enum puColor_define {
|
||
Dark = 0, // 000 = Dark Mode
|
||
Green, // = 1, Green
|
||
Red, // = 2, Red
|
||
Blue, // = 3, Blue
|
||
Yellow, // = 4, Yellow
|
||
Pink, // = 5, Pink
|
||
Cyan, // = 6, Cyan
|
||
White, // = 7, White
|
||
Red_Blue // = 8, Red/Blue Flashing
|
||
|
||
};
|
||
/* USER CODE END Private defines */
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
|
||
#endif /* __MAIN_H */
|
||
|
||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|