[hal] Add CAN Bus Map (#8765)

We will want a better API for higher level devices that expect to be on
motioncore, but for ones that are not expected to be, it'll be really
nice to have an API that can let us map the motioncore can bus to its
HAL index.
This commit is contained in:
Thad House
2026-04-16 21:03:39 -07:00
committed by GitHub
parent 628ba1458f
commit 8c80cdcf28
3 changed files with 84 additions and 1 deletions

View File

@@ -0,0 +1,45 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <stdint.h>
#include "wpi/hal/Types.h"
/**
* @defgroup hal_canapi CAN BUS Mapping Enums
* @ingroup hal_capi
* @{
*/
HAL_ENUM(HAL_CANBusMap) {
HAL_CAN_BUS_S0 = 0,
HAL_CAN_BUS_S1 = 1,
HAL_CAN_BUS_S2 = 2,
HAL_CAN_BUS_S3 = 3,
HAL_CAN_BUS_S4 = 4,
HAL_CAN_BUS_D0 = 5,
HAL_CAN_BUS_D1 = 6,
HAL_CAN_BUS_D2 = 7,
HAL_CAN_BUS_D3 = 8,
HAL_CAN_BUS_D4 = 9,
HAL_CAN_BUS_D5 = 10,
HAL_CAN_BUS_D6 = 11,
HAL_CAN_BUS_D7 = 12,
HAL_CAN_BUS_D8 = 13,
HAL_CAN_BUS_D9 = 14,
HAL_CAN_BUS_D10 = 15,
HAL_CAN_BUS_D11 = 16,
HAL_CAN_BUS_D12 = 17,
HAL_CAN_BUS_D13 = 18,
HAL_CAN_BUS_D14 = 19,
HAL_CAN_BUS_D15 = 20,
HAL_CAN_BUS_D16 = 21,
HAL_CAN_BUS_D17 = 22,
HAL_CAN_BUS_D18 = 23,
HAL_CAN_BUS_D19 = 24,
};
/** @} */