Bre*_*men 1 c struct microchip
所以我在查看 Microchip 的 dsPIC MCU 头文件时偶然发现了这个结构:
/* Generic structure of entire SFR area for each UART module */
typedef struct tagUART {
uint16_t uxmode;
uint16_t uxsta;
uint16_t uxtxreg;
uint16_t uxrxreg;
uint16_t uxbrg;
} UART, *PUART;
Run Code Online (Sandbox Code Playgroud)
我似乎无法弄清楚这里的类型或实例是什么(以及这样设计的目的是什么):
这是一种多合一的形式
struct tagUART { // the structure itself with all its details
uint16_t uxmode;
uint16_t uxsta;
uint16_t uxtxreg;
uint16_t uxrxreg;
uint16_t uxbrg;
};
typedef struct tagUART UART; // UART is a shorter name for struct tagUART
typedef struct tagUART *PUART; // PUART is a pointer-type to such a struct
Run Code Online (Sandbox Code Playgroud)