#include "Converter.h"

HAL_StatusTypeDef ftcan_init(CAN_HandleTypeDef *handle) {
  HAL_StatusTypeDef status = HAL_CAN_ActivateNotification(handle, CAN_IT_RX_FIFO0_MSG_PENDING);
  if (status != HAL_OK) {
    return status;
  }

  return HAL_CAN_Start(handle);
}

HAL_StatusTypeDef ftcan_transmit(CAN_HandleTypeDef *handle, uint16_t id, const uint8_t *data, size_t datalen) {
  static CAN_TxHeaderTypeDef header;
  header.StdId = id;
  header.IDE = CAN_ID_STD;
  header.RTR = CAN_RTR_DATA;
  header.DLC = datalen;
  uint32_t mailbox;
  return HAL_CAN_AddTxMessage(handle, &header, data, &mailbox);
}

uint16_t derived_t::size() { return 0; };
