C语言结构体 CanRxMsg 定义及变量声明

定义

typedef struct
{
  uint32_t StdId;  /*!< Specifies the standard identifier.
                        This parameter can be a value between 0 to 0x7FF. */

  uint32_t ExtId;  /*!< Specifies the extended identifier.
                        This parameter can be a value between 0 to 0x1FFFFFFF. */

  uint8_t IDE;     /*!< Specifies the type of identifier for the message that 
                        will be received. This parameter can be a value of 
                        @ref CAN_identifier_type */

  uint8_t RTR;     /*!< Specifies the type of frame for the received message.
                        This parameter can be a value of 
                        @ref CAN_remote_transmission_request */

  uint8_t DLC;     /*!< Specifies the length of the frame that will be received.
                        This parameter can be a value between 0 to 8 */

  uint8_t Data[8]; /*!< Contains the data to be received. It ranges from 0 to 
                        0xFF. */

  uint8_t FMI;     /*!< Specifies the index of the filter the message stored in 
                        the mailbox passes through. This parameter can be a 
                        value between 0 to 0xFF */
} CanRxMsg;

变量声明

CanRxMsg canRxMessage;

解释

声明的 CanRxMsg canRxMessage; 是结构体 CanRxMsg 中的一个变量。通过该变量 canRxMessage,您可以访问结构体中的各个成员,例如 canRxMessage.StdIdcanRxMessage.ExtId 等。

总结

结构体 CanRxMsg 用于接收 CAN 总线数据,变量 canRxMessageCanRxMsg 结构体的实例,可以通过该变量访问结构体的各个成员,以获取接收到的 CAN 数据信息。

C语言结构体 CanRxMsg 定义及变量声明

原文地址: https://www.cveoy.top/t/topic/oqa2 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录