| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- /*
- *
- *
- */
- #ifndef _ULT_H_
- #define _ULT_H_
- #include "time.h"
- /*************************************************************************************************/
- #ifndef FALSE
- #define FALSE 0
- #endif
- #ifndef TRUE
- //#define TRUE !(FALSE)
- #define TRUE 1
- #endif
- typedef union _u32_u8a_{
- uint32_t u32Data;
- uint8_t u8Data[4];
- }uConverterUint2Bytes;
- typedef union _u16_u8a_{
- uint32_t u16Data;
- uint8_t u8Data[2];
- }uConverterUshort2Bytes;
- typedef union _float_u8a_{
- float f32Data;
- uint8_t u8Data[4];
- }uConverterFloat2Bytes;
- #pragma pack(4)
- typedef struct _st_timer_
- {
- uint16_t flag;
- uint16_t enabled;
- uint16_t count;
- uint16_t limit;
- }stTickTimer,*pTickTimer;
- #pragma pack()
- /*
- typedef struct _rtc_time {
- uint16_t tm_sec;
- uint16_t tm_min;
- uint16_t tm_hour;
- uint16_t tm_mday;
- uint16_t tm_mon;
- uint16_t tm_year;
- uint16_t tm_wday;
- uint16_t tm_yday;
- }stRtcTime;*/
- typedef struct tm stRtcTime;
- typedef struct _time_set_value_
- {
- uint32_t tickReceived;
- uint32_t timeValue;
- }stTimeSetValue;
- #define SYS_Delay(us) Delay_us(us)
- /*************************************************************************************************/
- extern volatile stTickTimer keyScanTimer;
- extern volatile stTickTimer rakTimer;
- extern volatile stTickTimer senderTimer;
- extern volatile stTickTimer recordTimer;
- extern volatile stTickTimer tcpFlushTimer;
- extern volatile stTickTimer secondTimer;
- extern volatile stTickTimer halfMntTimer;
- extern stRtcTime rtcTime;
- extern volatile stTimeSetValue g_stTimeValue;
- /*************************************************************************************************/
- void RefreshTimer(void);
- void StartTimer(pTickTimer timer, uint32_t period);
- void StopTimer(pTickTimer timer);
- void ClearTimer(pTickTimer timer );
- void Systick_Init (unsigned char SYSCLK);
- void Delay_s( unsigned int time_s );
- void Delay_us(unsigned int time_us);
- void Delay_ms(unsigned int time_ms);
- unsigned short ATOI(char* str, unsigned char base); /* Convert a string to integer number */
- unsigned int ATOI32(char* str, unsigned char base); /* Convert a string to integer number */
- void itoa(unsigned int n, char* str, unsigned char len);
- int ValidATOI(char* str, int base, int* ret); /* Verify character string and Convert it to (hexa-)decimal. */
- char C2D(unsigned char c); /* Convert a character to HEX */
- unsigned short swaps(unsigned short i);
- unsigned int swapl(unsigned int l);
- void replacetochar(char * str, char oldchar, char newchar);
- void mid(char* src, char* s1, char* s2, char* sub);
- void inet_addr_(unsigned char* addr,unsigned char *ip);
- void rtcBySecondFromCentry(unsigned int time, stRtcTime *tm);
- void secondsFromCentry(const stRtcTime *tm, unsigned int * time);
- uint8_t BCC_CheckSum(uint8_t *buf, uint8_t len);
- unsigned int CalculateCRC16(unsigned char *updata, unsigned int len);
- int CRC16_Start();
- int CRC16_AddData(unsigned char *updata, unsigned int len);
- int CRC16_Finish();
- /*************************************************************************************************/
- #endif
|