driverlib/MSP432P4xx/eusci.h
拥有:
#define EUSCI_A_CMSIS(x) ((EUSCI_A_Type *) x)
inc/msp432p401r.h
拥有:
typedef struct {
__IO uint16_t CTLW0; /**< eUSCI_Ax Control Word Register 0 */
__IO uint16_t CTLW1; /**< eUSCI_Ax Control Word Register 1 */
uint16_t RESERVED0;
__IO uint16_t BRW; /**< eUSCI_Ax Baud Rate Control Word Register */
__IO uint16_t MCTLW; /**< eUSCI_Ax Modulation Control Word Register */
__IO uint16_t STATW; /**< eUSCI_Ax Status Register */
__I uint16_t RXBUF; /**< eUSCI_Ax Receive Buffer Register */
__IO uint16_t TXBUF; /**< eUSCI_Ax Transmit Buffer Register */
__IO uint16_t ABCTL; /**< eUSCI_Ax Auto Baud Rate Control Register */
__IO uint16_t IRCTL; /**< eUSCI_Ax IrDA Control Word Register */
uint16_t RESERVED1[3];
__IO uint16_t IE; /**< eUSCI_Ax Interrupt Enable Register */
__IO uint16_t IFG; /**< eUSCI_Ax Interrupt Flag Register */
__I uint16_t IV; /**< eUSCI_Ax Interrupt Vector Register */
} EUSCI_A_Type;
这些rXXX.r
东西只在 ROM driverlib 中使用。看起来好像每个寄存器都被声明为一个联合,可能是为了允许单独访问所有字节。ROM driverlib 的源代码永远无法更改,但您可以自己编译的 driverlib 的源代码(driverlib/MSP432P4xx/i2c.c
, not rom/MSP432P4xx/driverlib.c
)使用正确的声明。
(如果您不喜欢 CMSIS 样式的寄存器访问,请使用msp432p401r_classic.h
.)