mirror of
https://gitee.com/dlmu-cone/bf_original_balance_chassis
synced 2026-07-24 03:27:45 +08:00
更新dji_motor初始化的配置,优化参数传递
This commit is contained in:
@@ -57,7 +57,7 @@ static void CANServiceInit()
|
||||
|
||||
/* -----------------------two extern callable function -----------------------*/
|
||||
|
||||
void CANRegister(can_instance *ins, can_instance_config config)
|
||||
void CANRegister(can_instance *ins, can_instance_config_s config)
|
||||
{
|
||||
static uint8_t idx;
|
||||
if (!idx)
|
||||
|
||||
@@ -9,50 +9,44 @@
|
||||
#define MX_CAN_FILTER_CNT (2 * 14) // temporarily useless
|
||||
#define DEVICE_CAN_CNT 2 // CAN1,CAN2
|
||||
|
||||
|
||||
|
||||
/* can instance typedef, every module registered to CAN should have this variable */
|
||||
typedef struct _
|
||||
{
|
||||
CAN_HandleTypeDef* can_handle;
|
||||
CAN_HandleTypeDef *can_handle;
|
||||
CAN_TxHeaderTypeDef txconf;
|
||||
uint32_t tx_id;
|
||||
uint32_t tx_mailbox;
|
||||
uint8_t tx_buff[8];
|
||||
uint8_t tx_buff[8];
|
||||
uint8_t rx_buff[8];
|
||||
uint32_t rx_id;
|
||||
void (*can_module_callback)(struct _*); // callback needs an instance to tell among registered ones
|
||||
void (*can_module_callback)(struct _ *); // callback needs an instance to tell among registered ones
|
||||
} can_instance;
|
||||
|
||||
|
||||
/* this structure is used as initialization*/
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
CAN_HandleTypeDef* can_handle;
|
||||
CAN_HandleTypeDef *can_handle;
|
||||
uint32_t tx_id;
|
||||
uint32_t rx_id;
|
||||
void (*can_module_callback)(can_instance*);
|
||||
} can_instance_config;
|
||||
void (*can_module_callback)(can_instance *);
|
||||
} can_instance_config_s;
|
||||
|
||||
/* module callback,which resolve protocol when new mesg arrives*/
|
||||
typedef void (*can_callback)(can_instance*);
|
||||
|
||||
typedef void (*can_callback)(can_instance *);
|
||||
|
||||
/**
|
||||
* @brief transmit mesg through CAN device
|
||||
*
|
||||
*
|
||||
* @param _instance can instance owned by module
|
||||
*/
|
||||
void CANTransmit(can_instance* _instance);
|
||||
|
||||
void CANTransmit(can_instance *_instance);
|
||||
|
||||
/**
|
||||
* @brief Register a module to CAN service,remember to call this before using a CAN device
|
||||
*
|
||||
*
|
||||
* @param config init config
|
||||
* @return can_instance* can instance owned by module
|
||||
*/
|
||||
void CANRegister(can_instance* instance, can_instance_config config);
|
||||
|
||||
void CANRegister(can_instance *instance, can_instance_config_s config);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user