mirror of
https://github.com/HChaZZY/LoRaWAN_Project.git
synced 2025-12-06 10:33:51 +08:00
最终版本
This commit is contained in:
41
Inc/common/common.h
Normal file
41
Inc/common/common.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef _COMMON_H_
|
||||
#define _COMMON_H_
|
||||
#include "stdint.h"
|
||||
#include "stdbool.h"
|
||||
|
||||
|
||||
/** <20><>ȡ<EFBFBD><C8A1>ǰϵͳ<CFB5><CDB3>ʱ<EFBFBD>䣬<EFBFBD><E4A3AC>λΪms */
|
||||
#define GET_SYSTEM_TIME HAL_GetTick()
|
||||
|
||||
/** <20><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>MCU<43>Ĵ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD>滻<EFBFBD>궨<EFBFBD><EAB6A8> */
|
||||
#define DEBUG_PRINTF debug_printf
|
||||
|
||||
/** ȫ<>ֱ<EFBFBD><D6B1><EFBFBD> */
|
||||
extern bool timeout_start_flag; //Timeout sign
|
||||
|
||||
|
||||
/** <20>豸ģʽ<C4A3><CABD><EFBFBD>ܶ<EFBFBD><DCB6><EFBFBD> */
|
||||
typedef enum {
|
||||
CMD_CONFIG_MODE = 0,
|
||||
DATA_TRANSPORT_MODE,
|
||||
PRO_TRAINING_MODE,
|
||||
NO_MODE
|
||||
} DEVICE_MODE_T;
|
||||
|
||||
|
||||
/** ϵͳʱ<CDB3><CAB1><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> */
|
||||
#define SUBTRANCTION_CORSS_ZERO(e, s) e < s ? e + 4294967296 - s : e - s
|
||||
/*=====================================END======================================*/
|
||||
|
||||
/*-----------------------------<2D>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>---------------------------------*/
|
||||
void system_delay_ms(uint32_t delay);
|
||||
bool time_out_break_ms(uint32_t time);
|
||||
void lower2upper_and_remove_spaces(uint8_t *src, uint8_t *des);
|
||||
uint8_t* find_string(uint8_t *s, uint8_t *d);
|
||||
void match_string(uint8_t *str, uint8_t *s, uint8_t *e, uint8_t *res);
|
||||
uint32_t htoi(uint8_t s[], uint8_t size);
|
||||
/*=====================================END======================================*/
|
||||
|
||||
#endif //common.h
|
||||
|
||||
|
||||
41
Inc/common/common.h.orig
Normal file
41
Inc/common/common.h.orig
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef _COMMON_H_
|
||||
#define _COMMON_H_
|
||||
#include "stdint.h"
|
||||
#include "stdbool.h"
|
||||
|
||||
|
||||
/** <20><>ȡ<EFBFBD><C8A1>ǰϵͳ<CFB5><CDB3>ʱ<EFBFBD>䣬<EFBFBD><E4A3AC>λΪms */
|
||||
#define GET_SYSTEM_TIME HAL_GetTick()
|
||||
|
||||
/** <20><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>MCU<43>Ĵ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD>滻<EFBFBD>궨<EFBFBD><EAB6A8> */
|
||||
#define DEBUG_PRINTF debug_printf
|
||||
|
||||
/** ȫ<>ֱ<EFBFBD><D6B1><EFBFBD> */
|
||||
extern bool timeout_start_flag; //Timeout sign
|
||||
|
||||
|
||||
/** <20>豸ģʽ<C4A3><CABD><EFBFBD>ܶ<EFBFBD><DCB6><EFBFBD> */
|
||||
typedef enum {
|
||||
CMD_CONFIG_MODE = 0,
|
||||
DATA_TRANSPORT_MODE,
|
||||
PRO_TRAINING_MODE,
|
||||
NO_MODE
|
||||
} DEVICE_MODE_T;
|
||||
|
||||
|
||||
/** ϵͳʱ<CDB3><CAB1><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> */
|
||||
#define SUBTRANCTION_CORSS_ZERO(e, s) e < s ? e + 4294967296 - s : e - s
|
||||
/*=====================================END======================================*/
|
||||
|
||||
/*-----------------------------<2D>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>---------------------------------*/
|
||||
void system_delay_ms(uint32_t delay);
|
||||
bool time_out_break_ms(uint32_t time);
|
||||
void lower2upper_and_remove_spaces(uint8_t *src, uint8_t *des);
|
||||
uint8_t* find_string(uint8_t *s, uint8_t *d);
|
||||
void match_string(uint8_t *str, uint8_t *s, uint8_t *e, uint8_t *res);
|
||||
uint32_t htoi(uint8_t s[], uint8_t size);
|
||||
/*=====================================END======================================*/
|
||||
|
||||
#endif //common.h
|
||||
|
||||
|
||||
Reference in New Issue
Block a user