forked from SZV10X_Software/SZV103_FM33A0xxEV_SiZhu

jinlicong
2024-05-24 1360095f8d64cf607d333d2fc7fd1dcd81d1bd7b
Soft/system_general_para.h
@@ -1,6 +1,7 @@
#ifndef _SYSTEM_GENERAL_PARA_H
#define _SYSTEM_GENERAL_PARA_H
#include "define_all.h"
#include "extern_rtc.h"
/**************************************************
*Ö÷Òª¶¨ÒåһЩͨÓõĺ¯Êý¡¢±äÁ¿
@@ -82,6 +83,17 @@
} PARITY_BIT; //²¨ÌØÂÊ
typedef enum
{
   RS485_START_REASON_NONE = 0U,  //ÎÞ´¥·¢£¬²»ÐèÒªÖ´ÐÐ
  RS485_START_REASON_KEY ,  //°´¼ü
   RS485_START_REASON_TIMING,    //¶¨Ê±
   RS485_START_REASON_REPORT,    //Éϱ¨ÐèÒª
   RS485_START_REASON_RECORD,    //±£´æ¼Ç¼ÐèÒª£¬¿ÉÓÃÓÚÉϱ¨¶³½áµÈÇé¿ö
} RS485_START_REASON; //485Æô¶¯Ô­Òò
/*****************ͨÓýṹÌå²ÎÊý******************************/
typedef struct
{
@@ -92,7 +104,7 @@
typedef struct
{
  DELAY_SEC_TYPE_T gprs_timeout_para;     // GPRS³¬Ê±Ê±¼ä
  DELAY_SEC_TYPE_T wrc_timeout_para;     // GPRS³¬Ê±Ê±¼ä
  DELAY_SEC_TYPE_T sys_active_time;       // ÏµÍ³¼¤»îʱ¼ä
   DELAY_SEC_TYPE_T sys_restart_delay_time;// ÏµÍ³ÖØÆôµÄÑÓ³Ùʱ¼ä
   DELAY_SEC_TYPE_T UC_active_time;       // ÉÏλ»ú¼¤»îʱ¼ä
@@ -100,8 +112,20 @@
typedef struct
{
  __IO FlagStatus start_flag;  // ¹¦ÄÜÆô¶¯±êÖ¾
  __IO FlagStatus running_flag; // ¹¦ÄÜÔËÐÐÖбêÖ¾
} FUN_START_CTRL_T;         // ÑÓʱʱ¼äÀàÐͽṹÌå
typedef struct
{
  FUN_START_CTRL_T rs485_ctrl_flag;
  FUN_START_CTRL_T wrc_ctrl_flag;
   FUN_START_CTRL_T valve_ctrl_flag;
} FUN_START_CTRL_PARA_T;         // ÑÓʱʱ¼äÀàÐͽṹÌå
/*****************ͨÓúê******************************/
@@ -109,6 +133,9 @@
#define   DECIMAL_2_BCD(__DECIMAL__)    ((__DECIMAL__ / 16) * 10 + __DECIMAL__ % 16)
/*ÿÈÕ0µã*/
#define DAILY_ZERO ((&sys_clockBCD_g)->hour == 0 && (&sys_clockBCD_g)->min == 0 && (&sys_clockBCD_g)->sec == 0 ? SET : RESET)
// ´óС¶Ëת»»
#define BSWAP_16(x) ((x & 0x00ff) << 8) | \
@@ -135,7 +162,7 @@
// ÏµÍ³Í¨ÓÃÑÓ³Ùʱ¼äÉèÖÃ
#define __SYS_DELAY_SEC_TIME_SET_(__HANDLE__, __NUMBER__) ((&sys_delay_sec_para_g)->__HANDLE__.delay_time = __NUMBER__)
#define __SYS_DELAY_SEC_TIME_SET_(__HANDLE__, __NUMBER__) do{(&sys_delay_sec_para_g)->__HANDLE__.delay_time = __NUMBER__;__SYS_DELAY_SEC_FLAG_CLEAR_(__HANDLE__);}while(0);
// ÏµÍ³Í¨ÓÃÑÓ³Ùʱ¼ä»ñÈ¡
#define __SYS_DELAY_SEC_TIME_GET_(__HANDLE__)   ((&sys_delay_sec_para_g)->__HANDLE__.delay_time)
@@ -146,16 +173,6 @@
#define __SYS_DELAY_SEC_FLAG_SET_(__HANDLE__) ((&sys_delay_sec_para_g)->__HANDLE__.delay_flag = SET)
// ÏµÍ³Í¨ÓÃÑÓ³Ù±ê־λÇå³ý
#define __SYS_DELAY_SEC_FLAG_CLEAR_(__HANDLE__) ((&sys_delay_sec_para_g)->__HANDLE__.delay_flag = RESET)
@@ -177,18 +194,13 @@
//extern uint8_t read_data_buf_A_l[200];
//extern uint8_t read_data_buf_B_l[200];
//extern uint8_t read_data_buf_C_l[200];
extern __IO FlagStatus sys_run_period; // ÏµÍ³¼¤»îÖÜÆÚ
extern SYS_DELAY_SEC_PARA_T sys_delay_sec_para_g;
extern SYS_DELAY_SEC_PARA_T sys_delay_sec_para_g;  //ϵͳÑÓʱ¿ØÖÆ
extern FUN_START_CTRL_PARA_T sys_fun_run_ctrl_g;  //ϵͳ¹¦ÄÜÔËÐпØÖÆ
@@ -198,7 +210,7 @@
int mem_cmp_aray( const void * cs, const void * ct, u32 count );
//int mem_cmp_aray( const void * cs, const void * ct, u32 count );
uint8_t   TwoTimeCompara(uint8_t* TimeBCD1, uint8_t* TimeBCD2);//6×Ö½ÚBCDʱ¼äÓ뵱ǰʱ¼ä±È½Ï£¬µ±Ç°Ê±¼ä´ó·µ»Ø0£¬ÏàµÈ·µ»Ø1£¬µ±Ç°Ê±¼äС·µ»Ø2¡£  ´ËÍ⣬ËÑË÷µÄʱ¼ä¸ñʽÎÞЧҲ·µ»Ø0£¬¼ÌÐøËÑË÷¡£
@@ -206,5 +218,11 @@
//unsigned char HEX2BCD(unsigned char hex_data)  ; //HEX??BCD???     
void   dou26Byte( double data, unsigned char *array );
FlagStatus IntervalTriggerHandle(sClockBCD sys_clockBCD_in,uint16_t IntervalTime,uint8_t IntervalFirstTimeBCD[2]);
FlagStatus IO_JitterEliminationCheck(GPIO_Type* GPIOx, uint32_t GPIO_Pin,uint16_t delay_time_ms,BitAction bit_status);
int Datecmp(const uint8_t *pDate1, const uint8_t *pDate2);
#endif