CAN IDs don't fit in a uint8_t

This commit is contained in:
Jasper Blanckenburg 2023-03-15 18:04:44 +01:00
parent 8814b0bf7e
commit 1589839b44
2 changed files with 6 additions and 6 deletions

View File

@ -17,7 +17,7 @@ HAL_StatusTypeDef ftcan_init(CAN_HandleTypeDef *handle) {
return HAL_CAN_Start(hcan);
}
HAL_StatusTypeDef ftcan_transmit(uint8_t id, const uint8_t *data,
HAL_StatusTypeDef ftcan_transmit(uint16_t id, const uint8_t *data,
size_t datalen) {
static CAN_TxHeaderTypeDef header;
header.StdId = id;
@ -28,7 +28,7 @@ HAL_StatusTypeDef ftcan_transmit(uint8_t id, const uint8_t *data,
return HAL_CAN_AddTxMessage(hcan, &header, data, &mailbox);
}
HAL_StatusTypeDef ftcan_add_filter(uint8_t id, uint8_t mask) {
HAL_StatusTypeDef ftcan_add_filter(uint16_t id, uint16_t mask) {
static uint32_t next_filter_no = 0;
static CAN_FilterTypeDef filter;
if (next_filter_no % 2 == 0) {
@ -76,7 +76,7 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *handle) {
}
#endif // CAN_IS_BXCAN
__weak void ftcan_msg_received_cb(uint8_t id, size_t datalen,
__weak void ftcan_msg_received_cb(uint16_t id, size_t datalen,
const uint8_t *data) {}
uint64_t ftcan_unmarshal_unsigned(const uint8_t **data_ptr, size_t num_bytes) {

View File

@ -13,15 +13,15 @@
HAL_StatusTypeDef ftcan_init(CAN_HandleTypeDef *handle);
#endif // CAN_IS_BXCAN
HAL_StatusTypeDef ftcan_transmit(uint8_t id, const uint8_t *data,
HAL_StatusTypeDef ftcan_transmit(uint16_t id, const uint8_t *data,
size_t datalen);
HAL_StatusTypeDef ftcan_add_filter(uint8_t id, uint8_t mask);
HAL_StatusTypeDef ftcan_add_filter(uint16_t id, uint16_t mask);
/**
* Define this function to be notified of incoming CAN messages
*/
void ftcan_msg_received_cb(uint8_t id, size_t datalen, const uint8_t *data);
void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t *data);
/**
* Read num_bytes bytes from a message (unmarshalled network byte order). The