Red Bird Racing VCU v2
 
Loading...
Searching...
No Matches
Enums.hpp
Go to the documentation of this file.
1/**
2 * @file Enums.hpp
3 * @author Planeson, Red Bird Racing
4 * @brief Enumeration definitions for the VCU
5 * @version 1.3.1
6 * @date 2026-02-09
7 */
8
9#ifndef ENUMS_HPP
10#define ENUMS_HPP
11#include <stdint.h>
12#include <can.h> // canid_t
13
14/**
15 * @brief Main car status state machine.
16 *
17 * Represents the current state of the car in the startup and drive sequence.
18 */
19enum class CarStatus : uint8_t
20{
21 Init = 0, /**< Just started the car */
22 Startin = 1, /**< Driver holds "Start" button and full brakes (transition state) */
23 Bussin = 2, /**< Buzzer active, driver can release "Start" and brakes (transition state) */
24 Drive = 3 /**< Ready to drive, Drive mode LED on, throttle enabled */
25};
26
27/**
28 * @brief Pedal fault status codes.
29 *
30 * Represents the current fault status related to pedal input.
31 */
32enum class PedalFault : uint8_t
33{
34 None = 0x00, /**< No fault detected */
35 DiffStart = 0x10, /**< >10% difference fault just started */
36 DiffContinuing = 0x11, /**< >10% difference fault is ongoing */
37 DiffExceed100ms = 0x12, /**< >10% difference fault exceeded 100ms */
38 DiffResolved = 0x19, /**< Difference fault resolved */
39 ThrottleLow = 0x20, /**< Throttle pedal below lower threshold */
40 ThrottleHigh = 0x29, /**< Throttle pedal above upper threshold */
41 BrakeLow = 0x30, /**< Brake pedal below lower threshold */
42 BrakeHigh = 0x39, /**< Brake pedal above upper threshold */
43};
44
45/**
46 * @brief BMS status
47 *
48 * Represents the current state of the Battery Management System (BMS).
49 */
50enum class BmsStatus : uint8_t
51{
52 NoMsg = 0, /**< No message received from BMS */
53 //WrongId = 1, /**< Received message with wrong CAN ID */
54 Waiting = 1, /**< BMS is in standby, waiting to start HV */
55 Starting = 2, /**< BMS is starting high voltage */
56 Started = 3, /**< BMS has started high voltage */
57 Unused = 4 /**< Unused status code */
58};
59
60/**
61 * @brief MCP2515 instance indices.
62 *
63 * Used to identify different MCP2515 CAN controller instances.
64 */
65enum class McpIndex : uint8_t
66{
67 Motor = 0, /**< Motor CAN MCP2515 instance */
68 Bms = 1, /**< BMS CAN MCP2515 instance */
69 Datalogger = 2 /**< Datalogger CAN MCP2515 instance */
70};
71
72// === CAN IDs ===
73
74/**
75 * @brief CAN message IDs for status and brake debug.
76 *
77 * Used for sending car status and brake messages over CAN bus.
78 */
79enum class StatusCanId : canid_t
80{
81 CarMsg = 0x693, /**< Debug: car status message */
82 StaCarChangeMsg = 0x694, /**< Debug: car status change message */
83 BrakeMsg = 0x695, /**< Debug: brake status message */
84 BmsMsg = 0x696, /**< Debug: BMS status message */
85 HallSensorMsg = 0x697 /**< Debug: Hall sensor message */
86};
87
88#endif // ENUMS_HPP
McpIndex
MCP2515 instance indices.
Definition: Enums.hpp:66
CarStatus
Main car status state machine.
Definition: Enums.hpp:20
StatusCanId
CAN message IDs for status and brake debug.
Definition: Enums.hpp:80
PedalFault
Pedal fault status codes.
Definition: Enums.hpp:33
BmsStatus
BMS status.
Definition: Enums.hpp:51