#pragma once #ifdef __cplusplus extern "C" { #endif /* Includes ----------------------------------------------------------------- */ #include #include #include "bsp\can.h" #include "device\device.h" /* Exported constants ------------------------------------------------------- */ #define CAN_TX_SICK_BUF_SIZE (8) #define CAN_RX_SICK_BUF_SIZE (8) #define CAN_TX_BUF_SIZE_MAX (8) #define CAN_RX_BUF_SIZE_MAX (8) /* Exported macro ----------------------------------------------------------- */ /* Exported types ----------------------------------------------------------- */ // /* 型号 */ typedef enum { CAN_SICK1 = 0, CAN_SICK2, CAN_SICK3, CAN_SICK4, } CAN_Sick_t; // /* 电机反馈信息 */ // typedef struct { // float distance; // float save0; // float save1; // float save2; // } CAN_Sick_Feedback_t; typedef struct { float as_array[4]; struct { float s1; float s2; float s3; float s4 } named; } CAN_Sick_Output_t; typedef struct { CAN_Sick_Output_t sick; } CAN_Output_t; typedef struct { BSP_CAN_t sick; BSP_CAN_t c_board; } CAN_Params_t; typedef struct { uint32_t recive_flag; CAN_Sick_t sick; const CAN_Params_t *param; struct { uint32_t sick; } mailbox; osMessageQueueId_t msgq_raw; } CAN_t; typedef struct { CAN_RxHeaderTypeDef rx_header; uint8_t rx_data[CAN_RX_BUF_SIZE_MAX]; } CAN_RawRx_t; typedef struct { CAN_TxHeaderTypeDef tx_header; uint8_t tx_data[CAN_TX_BUF_SIZE_MAX]; } CAN_RawTx_t; // /* Exported functions prototypes -------------------------------------------- */ int8_t CAN_Init(CAN_t *can, const CAN_Params_t *param); #ifdef __cplusplus } #endif