1 Star 0 Fork 410

huangjiaqi/AT Command

forked from 魔罗/AT Command 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
comdef.h 1.95 KB
一键复制 编辑 原始数据 按行查看 历史
/******************************************************************************
* @brief 通用宏定义
*
* Copyright (c) 2018~2020, <morro_luo@163.com>
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-02-01 Morro Initial version.
******************************************************************************/
#ifndef _COM_DEF_H_
#define _COM_DEF_H_
#ifdef __cplusplus
extern "C" {
#endif
/*匿名类型定义 -----------------------------------------------------------*/
#define ANONY_CONN(type, var, line) type var##line
#define ANONY_DEF(type,prefix,line) ANONY_CONN(type, prefix, line)
#define ANONY_TYPE(type,prefix) ANONY_DEF(type, prefix, __LINE__)
/**
* container_of - cast a member of a structure out to the containing structure
* @ptr: the pointer to the member.
* @type: the type of the container struct this is embedded in.
* @member: the name of the member within the struct.
*
*/
#define container_of(ptr, type, member) ( \
(type *)( (char *)(ptr) - offsetof(type,member) ))
#if defined(__CC_ARM) || defined(__GNUC__) /* ARM,GCC*/
#define SECTION(x) __attribute__((section(x)))
#define UNUSED __attribute__((unused))
#define USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n)))
#define WEAK __attribute__((weak))
#elif defined (__ICCARM__) /*IAR */
#define SECTION(x) @ x
#define UNUSED
#define USED __root
#define WEAK __weak
#else
#error "Current tool chain haven't supported yet!"
#endif
/*数组元素个数 ---------------------------------------------------------------*/
#define ARRAY_COUNT(Array) (sizeof(Array) / sizeof(Array[0]))
#ifdef __cplusplus
}
#endif
#endif
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/kernaling/AT-Command.git
git@gitee.com:kernaling/AT-Command.git
kernaling
AT-Command
AT Command
master

搜索帮助