单片机中通用的类型别名

单片机中通用的类型别名

#ifndef _TYPE_H_
#define _TYPE_H_

#ifdef __GNUC__
#define __packed __attribute__((aligned(1)))
#endif

/* exact-width signed integer types */
typedef   signed           char int8_t;
typedef   signed short     int int16_t;
typedef   signed           int int32_t;


/* exact-width unsigned integer types */
typedef unsigned           char uint8_t;
typedef unsigned short     int uint16_t;
typedef unsigned           int uint32_t;
typedef unsigned           int size_t;

#ifndef NULL
#ifdef __cplusplus              // EC++
#define NULL   0
#else
#define NULL   ((void *) 0)
#endif
#endif

#ifndef boolean
typedef uint8_t boolean;
#endif

#ifndef MAX
#define MAX(x, y) ( ((x) > (y)) ? (x) : (y) )
#endif

#ifndef MIN
#define MIN(x, y) ( ((x) < (y)) ? (x) : (y) )
#endif

#endif /* _TYPE_H_ */



你可能感兴趣的:(C语言,51单片机,Cortex,M3/STM32F103,STM32F103基础篇)