有人可以向初学者解释以下结构吗:
typedef struct
{
__IO uint32_t CTRL; /**< Control Register */
__IO uint32_t CNT; /**< Counter Value Register */
__IO uint32_t COMP0; /**< Compare Value Register 0 */
__IO uint32_t COMP1; /**< Compare Value Register 1 */
__I uint32_t IF; /**< Interrupt Flag Register */
__IO uint32_t IFS; /**< Interrupt Flag Set Register */
__IO uint32_t IFC; /**< Interrupt Flag Clear Register */
__IO uint32_t IEN; /**< Interrupt Enable Register */
__IO uint32_t FREEZE; /**< Freeze Register */
__I uint32_t SYNCBUSY; /**< Synchronization Busy Register */
} RTC_TypeDef;
#define RTC_BASE (0x40080000UL)
#define RTC ((RTC_TypeDef *) RTC_BASE)
尤其是最后一行
为什么括号如此不寻常? * 是什么意思?指针还是乘法运算符?
谢谢
最佳答案
Why are the brackets so unusual? What does the * mean? Pointer or multiply operator ?
*
这是一个指针而不是乘法运算符。
这个宏并没有什么不寻常的地方。它只是将地址类型转换为 struct RTC_TypeDef
类型
关于c - 周边定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30614648/