From 4bb5fa85491c5854780a26376666ce7e5245ef96 Mon Sep 17 00:00:00 2001 From: CaoWangrenbo Date: Sat, 16 Dec 2023 11:30:39 +0800 Subject: [PATCH] =?UTF-8?q?pref=EF=BC=9A=20=E4=BF=AE=E6=94=B9=E9=80=90?= =?UTF-8?q?=E9=A3=9E=E5=85=B3=E4=BA=8E=20uint32=20=E5=92=8C=20int32=20?= =?UTF-8?q?=E7=9A=84=E5=AE=9A=E4=B9=89=EF=BC=8C=E4=BD=BF=E5=85=B6=E7=AC=A6?= =?UTF-8?q?=E5=90=88=E9=9D=99=E6=80=81=E6=A3=80=E6=9F=A5=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libraries/zf_common/zf_common_typedef.h | 116 +++++++++++++----------- 1 file changed, 61 insertions(+), 55 deletions(-) diff --git a/libraries/zf_common/zf_common_typedef.h b/libraries/zf_common/zf_common_typedef.h index 6778a29..210cbd3 100644 --- a/libraries/zf_common/zf_common_typedef.h +++ b/libraries/zf_common/zf_common_typedef.h @@ -1,37 +1,37 @@ /********************************************************************************************************************* -* CH32V307VCT6 Opensourec Library 即(CH32V307VCT6 开源库)是一个基于官方 SDK 接口的第三方开源库 -* Copyright (c) 2022 SEEKFREE 逐飞科技 -* -* 本文件是CH32V307VCT6 开源库的一部分 -* -* CH32V307VCT6 开源库 是免费软件 -* 您可以根据自由软件基金会发布的 GPL(GNU General Public License,即 GNU通用公共许可证)的条款 -* 即 GPL 的第3版(即 GPL3.0)或(您选择的)任何后来的版本,重新发布和/或修改它 -* -* 本开源库的发布是希望它能发挥作用,但并未对其作任何的保证 -* 甚至没有隐含的适销性或适合特定用途的保证 -* 更多细节请参见 GPL -* -* 您应该在收到本开源库的同时收到一份 GPL 的副本 -* 如果没有,请参阅 -* -* 额外注明: -* 本开源库使用 GPL3.0 开源许可证协议 以上许可申明为译文版本 -* 许可申明英文版在 libraries/doc 文件夹下的 GPL3_permission_statement.txt 文件中 -* 许可证副本在 libraries 文件夹下 即该文件夹下的 LICENSE 文件 -* 欢迎各位使用并传播本程序 但修改内容时必须保留逐飞科技的版权声明(即本声明) -* -* 文件名称 zf_common_typedef -* 公司名称 成都逐飞科技有限公司 -* 版本信息 查看 libraries/doc 文件夹内 version 文件 版本说明 -* 开发环境 MounRiver Studio V1.8.1 -* 适用平台 CH32V307VCT6 -* 店铺链接 https://seekfree.taobao.com/ -* -* 修改记录 -* 日期 作者 备注 -* 2022-09-15 大W first version -********************************************************************************************************************/ + * CH32V307VCT6 Opensourec Library 即(CH32V307VCT6 开源库)是一个基于官方 SDK 接口的第三方开源库 + * Copyright (c) 2022 SEEKFREE 逐飞科技 + * + * 本文件是CH32V307VCT6 开源库的一部分 + * + * CH32V307VCT6 开源库 是免费软件 + * 您可以根据自由软件基金会发布的 GPL(GNU General Public License,即 GNU通用公共许可证)的条款 + * 即 GPL 的第3版(即 GPL3.0)或(您选择的)任何后来的版本,重新发布和/或修改它 + * + * 本开源库的发布是希望它能发挥作用,但并未对其作任何的保证 + * 甚至没有隐含的适销性或适合特定用途的保证 + * 更多细节请参见 GPL + * + * 您应该在收到本开源库的同时收到一份 GPL 的副本 + * 如果没有,请参阅 + * + * 额外注明: + * 本开源库使用 GPL3.0 开源许可证协议 以上许可申明为译文版本 + * 许可申明英文版在 libraries/doc 文件夹下的 GPL3_permission_statement.txt 文件中 + * 许可证副本在 libraries 文件夹下 即该文件夹下的 LICENSE 文件 + * 欢迎各位使用并传播本程序 但修改内容时必须保留逐飞科技的版权声明(即本声明) + * + * 文件名称 zf_common_typedef + * 公司名称 成都逐飞科技有限公司 + * 版本信息 查看 libraries/doc 文件夹内 version 文件 版本说明 + * 开发环境 MounRiver Studio V1.8.1 + * 适用平台 CH32V307VCT6 + * 店铺链接 https://seekfree.taobao.com/ + * + * 修改记录 + * 日期 作者 备注 + * 2022-09-15 大W first version + ********************************************************************************************************************/ #ifndef _zf_common_typedef_h_ #define _zf_common_typedef_h_ @@ -45,36 +45,42 @@ //=================================================== 类型定义 =================================================== -//#define COMPATIBLE_WITH_OLDER_VERSIONS // 兼容旧版开源库接口 -#define USE_ZF_TYPEDEF (1) // 是否启用类型定义申明 +// #define COMPATIBLE_WITH_OLDER_VERSIONS // 兼容旧版开源库接口 +#define USE_ZF_TYPEDEF (1) // 是否启用类型定义申明 #if USE_ZF_TYPEDEF // 数据类型声明 // 尽量使用 stdint.h 定义的类型名称 避免冲突 这里可以裁剪 -typedef unsigned char uint8; // 无符号 8 bits -typedef unsigned short int uint16; // 无符号 16 bits -typedef unsigned int uint32; // 无符号 32 bits -typedef unsigned long long uint64; // 无符号 64 bits -typedef signed char int8; // 有符号 8 bits -typedef signed short int int16; // 有符号 16 bits -typedef signed int int32; // 有符号 32 bits -typedef signed long long int64; // 有符号 64 bits +// 上面话说的挺好,uint32(aka unsigned int) 和 uint32_t(aka unsigned long) 不一致 +// 虽然在 32 位机上都是四字节,但是静态检查总会有提示,很不爽,等下改掉 +// typedef unsigned int uint32; // 无符号 32 bits -typedef volatile uint8 vuint8; // 易变性修饰 无符号 8 bits -typedef volatile uint16 vuint16; // 易变性修饰 无符号 16 bits -typedef volatile uint32 vuint32; // 易变性修饰 无符号 32 bits -typedef volatile uint64 vuint64; // 易变性修饰 无符号 64 bits +typedef unsigned char uint8; // 无符号 8 bits +typedef unsigned short uint16; // 无符号 16 bits -typedef volatile int8 vint8; // 易变性修饰 有符号 8 bits -typedef volatile int16 vint16; // 易变性修饰 有符号 16 bits -typedef volatile int32 vint32; // 易变性修饰 有符号 32 bits -typedef volatile int64 vint64; // 易变性修饰 有符号 64 bits +typedef unsigned long uint32; // 无符号 32 bits +typedef unsigned long long uint64; // 无符号 64 bits -#define ZF_ENABLE (1) -#define ZF_DISABLE (0) +typedef signed char int8; // 有符号 8 bits +typedef signed short int16; // 有符号 16 bits +typedef signed long int32; // 有符号 32 bits +typedef signed long long int64; // 有符号 64 bits -#define ZF_TRUE (1) -#define ZF_FALSE (0) +typedef volatile uint8 vuint8; // 易变性修饰 无符号 8 bits +typedef volatile uint16 vuint16; // 易变性修饰 无符号 16 bits +typedef volatile uint32 vuint32; // 易变性修饰 无符号 32 bits +typedef volatile uint64 vuint64; // 易变性修饰 无符号 64 bits + +typedef volatile int8 vint8; // 易变性修饰 有符号 8 bits +typedef volatile int16 vint16; // 易变性修饰 有符号 16 bits +typedef volatile int32 vint32; // 易变性修饰 有符号 32 bits +typedef volatile int64 vint64; // 易变性修饰 有符号 64 bits + +#define ZF_ENABLE (1) +#define ZF_DISABLE (0) + +#define ZF_TRUE (1) +#define ZF_FALSE (0) #endif //=================================================== 类型定义 ===================================================