Files
CHJ/user/Main/GlobeTypeDef.h
2026-03-20 21:16:58 +08:00

142 lines
4.2 KiB
C
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/********************************************************************************************************
** 全局常数与子程序定义头文件
**
** Copyright (c) Siargo, Ltd. 2010
** All Rights Reserved.
**
**-------------------------------------------------------------------------------------------------------
********************************************************************************************************/
#ifndef __GlobeTypeDef_H__
#define __GlobeTypeDef_H__
#define __weak __WEAK
#define RAM_START 0x20000600
//typedef u8 u8;
typedef uint8_t u8; // 无符号8位整型变量
typedef int8_t s8; // 有符号8位整型变量
typedef uint16_t u16; // 无符号16位整型变量
typedef unsigned short int u16;
typedef int16_t s16; // 有符号16位整型变量
typedef uint32_t u32; // 无符号32位整型变量
typedef int32_t s32; // 有符号32位整型变量
typedef uint64_t u64; // 无符号64位整型变量
typedef int64_t s64; // 有符号64位整型变量
typedef float f32; // 单精度浮点数32位长度
typedef double f64; // 双精度浮点数64位长度
//typedef __IO uint8_t vu8; // 无符号8位整型变量
//typedef __IO int8_t vs8; // 有符号8位整型变量
//typedef __IO uint16_t vu16; // 无符号16位整型变量
//typedef __IO int16_t vs16; // 有符号16位整型变量
//typedef __IO uint32_t vu32; // 无符号32位整型变量
//typedef __IO int32_t vs32; // 有符号32位整型变量
//typedef __IO uint64_t vu64; // 无符号64位整型变量
//typedef __IO int64_t vs64; // 有符号64位整型变量
//typedef __IO float vf32; // 单精度浮点数32位长度
//typedef __IO double vf64; // 双精度浮点数64位长度
//typedef bool INT1;
//typedef unsigned char INT8;
//typedef unsigned char BYTE;
//typedef u16 int INT16;
//typedef unsigned long int INT32;
//typedef unsigned long int INTADC;
/* Public typedef ------------------------------------------------------------*/
/* 字/字节联合类型定义 */
typedef union tagWordType
{
u16 Word;
u8 Byte[2];
} TypeWord;
/* 双字/字/字节联合类型定义 */
typedef union tagLongType
{
u32 DWord;
//float Float;
u16 Word[2];
u8 Byte[4];
} TypeLong;
/* 双字/字/字节联合类型定义 */
typedef union tagLongLongType
{
u64 DDWord;
u32 DWord[2];
u16 Word[4];
u8 Byte[8];
} TypeLongLong;
#define BIT0 0x0001
#define BIT1 0x0002
#define BIT2 0x0004
#define BIT3 0x0008
#define BIT4 0x0010
#define BIT5 0x0020
#define BIT6 0x0040
#define BIT7 0x0080
#define BIT8 0x0100
#define BIT9 0x0200
#define BIT10 0x0400
#define BIT11 0x0800
#define BIT12 0x1000
#define BIT13 0x2000
#define BIT14 0x4000
#define BIT15 0x8000
#define BIT16 0x10000
#define BITA BIT10
#define BITB BIT11
#define BITC BIT12
#define BITD BIT13
#define BITE BIT14
#define BITF BIT15
//******************************************************************************
// for port 1 & 2 interrupt
#define BIT0_VECTOR 2
#define BIT1_VECTOR 4
#define BIT2_VECTOR 6
#define BIT3_VECTOR 8
#define BIT4_VECTOR 10
#define BIT5_VECTOR 12
#define BIT6_VECTOR 14
#define BIT7_VECTOR 16
#define OUT_HIGH GPIO_PIN_SET
#define OUT_LOW GPIO_PIN_RESET
typedef struct
{
u32 SampledOver: 1;
u32 ExtPowerInput: 1;
u32 EnableSaveACC: 1;
u32 EnableInit: 1;
u32 CalibMode: 1;
u32 TurnOffSystem: 1;
u32 EnableRead: 1;
u32 EnableD9V2: 1;
u32 EnablePulseUpdate: 1;
u32 EnablePress: 1;
}__SYS_BIT_TypeDef;
typedef struct
{
u32 UARTHandle: 1;
u32 I2CHandle: 1;
}__SYS_STATUS_BIT_TypeDef;
typedef enum
{
ADR_0X00 = 0,
ADR_0X01,
ADR_0X02,
ADR_0X03,
ADR_0X04
} __REGADR_TypeDef;
#endif