pub struct CarState(/* private fields */);Implementations§
Source§impl CarState
impl CarState
Sourcepub const fn home_mode(&self) -> u8
pub const fn home_mode(&self) -> u8
Whether or not VCU is in home mode.
In the firmware, this value corresponds to the value of the bool get_nero_state().home_mode.
Bits: 0..4
Sourcepub const fn with_home_mode_checked(self, value: u8) -> Result<Self, ()>
pub const fn with_home_mode_checked(self, value: u8) -> Result<Self, ()>
Whether or not VCU is in home mode.
In the firmware, this value corresponds to the value of the bool get_nero_state().home_mode.
Bits: 0..4
Sourcepub const fn with_home_mode(self, value: u8) -> Self
pub const fn with_home_mode(self, value: u8) -> Self
Whether or not VCU is in home mode.
In the firmware, this value corresponds to the value of the bool get_nero_state().home_mode.
Bits: 0..4
Sourcepub const fn set_home_mode(&mut self, value: u8)
pub const fn set_home_mode(&mut self, value: u8)
Whether or not VCU is in home mode.
In the firmware, this value corresponds to the value of the bool get_nero_state().home_mode.
Bits: 0..4
Sourcepub const fn set_home_mode_checked(&mut self, value: u8) -> Result<(), ()>
pub const fn set_home_mode_checked(&mut self, value: u8) -> Result<(), ()>
Whether or not VCU is in home mode.
In the firmware, this value corresponds to the value of the bool get_nero_state().home_mode.
Bits: 0..4
Sourcepub const fn nero_index(&self) -> u8
pub const fn nero_index(&self) -> u8
VCU’s current nero_index value.
In the firmware, this value corresponds to the value of get_nero_state().nero_index, which is of type nero_menu_t. 0=OFF, 1=PIT, 2=REVERSE, 3=PERFORMANCE, 4=EFFICIENCY, 5=GAMES, 6=EXIT. This description was last updated on 12/14/2025, so please modify it if there have been any changes in the firmware.
Bits: 4..8
Sourcepub const fn with_nero_index_checked(self, value: u8) -> Result<Self, ()>
pub const fn with_nero_index_checked(self, value: u8) -> Result<Self, ()>
VCU’s current nero_index value.
In the firmware, this value corresponds to the value of get_nero_state().nero_index, which is of type nero_menu_t. 0=OFF, 1=PIT, 2=REVERSE, 3=PERFORMANCE, 4=EFFICIENCY, 5=GAMES, 6=EXIT. This description was last updated on 12/14/2025, so please modify it if there have been any changes in the firmware.
Bits: 4..8
Sourcepub const fn with_nero_index(self, value: u8) -> Self
pub const fn with_nero_index(self, value: u8) -> Self
VCU’s current nero_index value.
In the firmware, this value corresponds to the value of get_nero_state().nero_index, which is of type nero_menu_t. 0=OFF, 1=PIT, 2=REVERSE, 3=PERFORMANCE, 4=EFFICIENCY, 5=GAMES, 6=EXIT. This description was last updated on 12/14/2025, so please modify it if there have been any changes in the firmware.
Bits: 4..8
Sourcepub const fn set_nero_index(&mut self, value: u8)
pub const fn set_nero_index(&mut self, value: u8)
VCU’s current nero_index value.
In the firmware, this value corresponds to the value of get_nero_state().nero_index, which is of type nero_menu_t. 0=OFF, 1=PIT, 2=REVERSE, 3=PERFORMANCE, 4=EFFICIENCY, 5=GAMES, 6=EXIT. This description was last updated on 12/14/2025, so please modify it if there have been any changes in the firmware.
Bits: 4..8
Sourcepub const fn set_nero_index_checked(&mut self, value: u8) -> Result<(), ()>
pub const fn set_nero_index_checked(&mut self, value: u8) -> Result<(), ()>
VCU’s current nero_index value.
In the firmware, this value corresponds to the value of get_nero_state().nero_index, which is of type nero_menu_t. 0=OFF, 1=PIT, 2=REVERSE, 3=PERFORMANCE, 4=EFFICIENCY, 5=GAMES, 6=EXIT. This description was last updated on 12/14/2025, so please modify it if there have been any changes in the firmware.
Bits: 4..8
Sourcepub const fn car_speed(&self) -> f32
pub const fn car_speed(&self) -> f32
Speed of the car, in miles per hour.
Units: mph
Bits: 8..24
Sourcepub const fn with_car_speed_checked(self, value: f32) -> Result<Self, ()>
pub const fn with_car_speed_checked(self, value: f32) -> Result<Self, ()>
Speed of the car, in miles per hour.
Units: mph
Bits: 8..24
Sourcepub const fn with_car_speed(self, value: f32) -> Self
pub const fn with_car_speed(self, value: f32) -> Self
Speed of the car, in miles per hour.
Units: mph
Bits: 8..24
Sourcepub const fn set_car_speed(&mut self, value: f32)
pub const fn set_car_speed(&mut self, value: f32)
Speed of the car, in miles per hour.
Units: mph
Bits: 8..24
Sourcepub const fn set_car_speed_checked(&mut self, value: f32) -> Result<(), ()>
pub const fn set_car_speed_checked(&mut self, value: f32) -> Result<(), ()>
Speed of the car, in miles per hour.
Units: mph
Bits: 8..24
Sourcepub const fn tsms(&self) -> bool
pub const fn tsms(&self) -> bool
Whether or not shutdown is closed.
Refers to the “Official” TSMS state (not the raw pin state, but the state stored in the debounced ‘tsms’ bool).
Bits: 24..25
Sourcepub const fn with_tsms_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_tsms_checked(self, value: bool) -> Result<Self, ()>
Whether or not shutdown is closed.
Refers to the “Official” TSMS state (not the raw pin state, but the state stored in the debounced ‘tsms’ bool).
Bits: 24..25
Sourcepub const fn with_tsms(self, value: bool) -> Self
pub const fn with_tsms(self, value: bool) -> Self
Whether or not shutdown is closed.
Refers to the “Official” TSMS state (not the raw pin state, but the state stored in the debounced ‘tsms’ bool).
Bits: 24..25
Sourcepub const fn set_tsms(&mut self, value: bool)
pub const fn set_tsms(&mut self, value: bool)
Whether or not shutdown is closed.
Refers to the “Official” TSMS state (not the raw pin state, but the state stored in the debounced ‘tsms’ bool).
Bits: 24..25
Sourcepub const fn set_tsms_checked(&mut self, value: bool) -> Result<(), ()>
pub const fn set_tsms_checked(&mut self, value: bool) -> Result<(), ()>
Whether or not shutdown is closed.
Refers to the “Official” TSMS state (not the raw pin state, but the state stored in the debounced ‘tsms’ bool).
Bits: 24..25
Sourcepub const fn torque_limit_percentage(&self) -> f32
pub const fn torque_limit_percentage(&self) -> f32
The torque limit selected by the driver.
Bits: 25..32
Sourcepub const fn with_torque_limit_percentage_checked(
self,
value: f32,
) -> Result<Self, ()>
pub const fn with_torque_limit_percentage_checked( self, value: f32, ) -> Result<Self, ()>
The torque limit selected by the driver.
Bits: 25..32
Sourcepub const fn with_torque_limit_percentage(self, value: f32) -> Self
pub const fn with_torque_limit_percentage(self, value: f32) -> Self
The torque limit selected by the driver.
Bits: 25..32
Sourcepub const fn set_torque_limit_percentage(&mut self, value: f32)
pub const fn set_torque_limit_percentage(&mut self, value: f32)
The torque limit selected by the driver.
Bits: 25..32
Sourcepub const fn set_torque_limit_percentage_checked(
&mut self,
value: f32,
) -> Result<(), ()>
pub const fn set_torque_limit_percentage_checked( &mut self, value: f32, ) -> Result<(), ()>
The torque limit selected by the driver.
Bits: 25..32
Sourcepub const fn reverse(&self) -> bool
pub const fn reverse(&self) -> bool
Whether or not the car is in reverse.
‘1’ means that cerberus_state.functional != F_REVERSE. ‘0’ means that ‘cerberus_state.functional == F_REVERSE’.
Bits: 32..33
Sourcepub const fn with_reverse_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_reverse_checked(self, value: bool) -> Result<Self, ()>
Whether or not the car is in reverse.
‘1’ means that cerberus_state.functional != F_REVERSE. ‘0’ means that ‘cerberus_state.functional == F_REVERSE’.
Bits: 32..33
Sourcepub const fn with_reverse(self, value: bool) -> Self
pub const fn with_reverse(self, value: bool) -> Self
Whether or not the car is in reverse.
‘1’ means that cerberus_state.functional != F_REVERSE. ‘0’ means that ‘cerberus_state.functional == F_REVERSE’.
Bits: 32..33
Sourcepub const fn set_reverse(&mut self, value: bool)
pub const fn set_reverse(&mut self, value: bool)
Whether or not the car is in reverse.
‘1’ means that cerberus_state.functional != F_REVERSE. ‘0’ means that ‘cerberus_state.functional == F_REVERSE’.
Bits: 32..33
Sourcepub const fn set_reverse_checked(&mut self, value: bool) -> Result<(), ()>
pub const fn set_reverse_checked(&mut self, value: bool) -> Result<(), ()>
Whether or not the car is in reverse.
‘1’ means that cerberus_state.functional != F_REVERSE. ‘0’ means that ‘cerberus_state.functional == F_REVERSE’.
Bits: 32..33
Sourcepub const fn regen_limit(&self) -> u16
pub const fn regen_limit(&self) -> u16
The regenerative braking current limit (selected by the driver).
Units: A
Bits: 33..43
Sourcepub const fn with_regen_limit_checked(self, value: u16) -> Result<Self, ()>
pub const fn with_regen_limit_checked(self, value: u16) -> Result<Self, ()>
The regenerative braking current limit (selected by the driver).
Units: A
Bits: 33..43
Sourcepub const fn with_regen_limit(self, value: u16) -> Self
pub const fn with_regen_limit(self, value: u16) -> Self
The regenerative braking current limit (selected by the driver).
Units: A
Bits: 33..43
Sourcepub const fn set_regen_limit(&mut self, value: u16)
pub const fn set_regen_limit(&mut self, value: u16)
The regenerative braking current limit (selected by the driver).
Units: A
Bits: 33..43
Sourcepub const fn set_regen_limit_checked(&mut self, value: u16) -> Result<(), ()>
pub const fn set_regen_limit_checked(&mut self, value: u16) -> Result<(), ()>
The regenerative braking current limit (selected by the driver).
Units: A
Bits: 33..43
Sourcepub const fn launch_control(&self) -> bool
pub const fn launch_control(&self) -> bool
Whether or not launch control is enabled.
‘1’ indicates that launch control is enabled. ‘0’ indicates that launch control is disabled.
Bits: 43..44
Sourcepub const fn with_launch_control_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_launch_control_checked(self, value: bool) -> Result<Self, ()>
Whether or not launch control is enabled.
‘1’ indicates that launch control is enabled. ‘0’ indicates that launch control is disabled.
Bits: 43..44
Sourcepub const fn with_launch_control(self, value: bool) -> Self
pub const fn with_launch_control(self, value: bool) -> Self
Whether or not launch control is enabled.
‘1’ indicates that launch control is enabled. ‘0’ indicates that launch control is disabled.
Bits: 43..44
Sourcepub const fn set_launch_control(&mut self, value: bool)
pub const fn set_launch_control(&mut self, value: bool)
Whether or not launch control is enabled.
‘1’ indicates that launch control is enabled. ‘0’ indicates that launch control is disabled.
Bits: 43..44
Sourcepub const fn set_launch_control_checked(
&mut self,
value: bool,
) -> Result<(), ()>
pub const fn set_launch_control_checked( &mut self, value: bool, ) -> Result<(), ()>
Whether or not launch control is enabled.
‘1’ indicates that launch control is enabled. ‘0’ indicates that launch control is disabled.
Bits: 43..44
Sourcepub const fn functional_state(&self) -> u8
pub const fn functional_state(&self) -> u8
VCU’s functional state.
Check func_state_t in Cerberus-2.0 to see what each value refers to.
Bits: 44..47
Sourcepub const fn with_functional_state_checked(self, value: u8) -> Result<Self, ()>
pub const fn with_functional_state_checked(self, value: u8) -> Result<Self, ()>
VCU’s functional state.
Check func_state_t in Cerberus-2.0 to see what each value refers to.
Bits: 44..47
Sourcepub const fn with_functional_state(self, value: u8) -> Self
pub const fn with_functional_state(self, value: u8) -> Self
VCU’s functional state.
Check func_state_t in Cerberus-2.0 to see what each value refers to.
Bits: 44..47
Sourcepub const fn set_functional_state(&mut self, value: u8)
pub const fn set_functional_state(&mut self, value: u8)
VCU’s functional state.
Check func_state_t in Cerberus-2.0 to see what each value refers to.
Bits: 44..47
Sourcepub const fn set_functional_state_checked(
&mut self,
value: u8,
) -> Result<(), ()>
pub const fn set_functional_state_checked( &mut self, value: u8, ) -> Result<(), ()>
VCU’s functional state.
Check func_state_t in Cerberus-2.0 to see what each value refers to.
Bits: 44..47
Sourcepub const fn traction_control(&self) -> bool
pub const fn traction_control(&self) -> bool
Whether or not traction control is enabled.
‘1’ = traction control is enabled, ‘0’ = traction control is not enabled.
Bits: 47..48
Sourcepub const fn with_traction_control_checked(
self,
value: bool,
) -> Result<Self, ()>
pub const fn with_traction_control_checked( self, value: bool, ) -> Result<Self, ()>
Whether or not traction control is enabled.
‘1’ = traction control is enabled, ‘0’ = traction control is not enabled.
Bits: 47..48
Sourcepub const fn with_traction_control(self, value: bool) -> Self
pub const fn with_traction_control(self, value: bool) -> Self
Whether or not traction control is enabled.
‘1’ = traction control is enabled, ‘0’ = traction control is not enabled.
Bits: 47..48
Sourcepub const fn set_traction_control(&mut self, value: bool)
pub const fn set_traction_control(&mut self, value: bool)
Whether or not traction control is enabled.
‘1’ = traction control is enabled, ‘0’ = traction control is not enabled.
Bits: 47..48
Sourcepub const fn set_traction_control_checked(
&mut self,
value: bool,
) -> Result<(), ()>
pub const fn set_traction_control_checked( &mut self, value: bool, ) -> Result<(), ()>
Whether or not traction control is enabled.
‘1’ = traction control is enabled, ‘0’ = traction control is not enabled.
Bits: 47..48
Sourcepub const fn state_transition_error(&self) -> u8
pub const fn state_transition_error(&self) -> u8
Bitmask of the most recent state-transition rejection reason(s). 0 = OK.
Bits map to state_transition_error_t in u_statemachine.h: REVERSE_DISABLED=1, DRIVE_FROM_FAULT=2, ENTER_DRIVE_DISABLED=4, ENTER_DRIVE_SHUTDOWN_OPEN=8, ENTER_DRIVE_BREAKS_NOT_ENGAGED=16, ENTER_GAMES_SHUTDOWN_CLOSED=32, ENTER_GAMES_WHILE_MOVING=64, CHANGE_STATE_ACCEL_PRESSED=128.
Bits: 48..56
Sourcepub const fn with_state_transition_error_checked(
self,
value: u8,
) -> Result<Self, ()>
pub const fn with_state_transition_error_checked( self, value: u8, ) -> Result<Self, ()>
Bitmask of the most recent state-transition rejection reason(s). 0 = OK.
Bits map to state_transition_error_t in u_statemachine.h: REVERSE_DISABLED=1, DRIVE_FROM_FAULT=2, ENTER_DRIVE_DISABLED=4, ENTER_DRIVE_SHUTDOWN_OPEN=8, ENTER_DRIVE_BREAKS_NOT_ENGAGED=16, ENTER_GAMES_SHUTDOWN_CLOSED=32, ENTER_GAMES_WHILE_MOVING=64, CHANGE_STATE_ACCEL_PRESSED=128.
Bits: 48..56
Sourcepub const fn with_state_transition_error(self, value: u8) -> Self
pub const fn with_state_transition_error(self, value: u8) -> Self
Bitmask of the most recent state-transition rejection reason(s). 0 = OK.
Bits map to state_transition_error_t in u_statemachine.h: REVERSE_DISABLED=1, DRIVE_FROM_FAULT=2, ENTER_DRIVE_DISABLED=4, ENTER_DRIVE_SHUTDOWN_OPEN=8, ENTER_DRIVE_BREAKS_NOT_ENGAGED=16, ENTER_GAMES_SHUTDOWN_CLOSED=32, ENTER_GAMES_WHILE_MOVING=64, CHANGE_STATE_ACCEL_PRESSED=128.
Bits: 48..56
Sourcepub const fn set_state_transition_error(&mut self, value: u8)
pub const fn set_state_transition_error(&mut self, value: u8)
Bitmask of the most recent state-transition rejection reason(s). 0 = OK.
Bits map to state_transition_error_t in u_statemachine.h: REVERSE_DISABLED=1, DRIVE_FROM_FAULT=2, ENTER_DRIVE_DISABLED=4, ENTER_DRIVE_SHUTDOWN_OPEN=8, ENTER_DRIVE_BREAKS_NOT_ENGAGED=16, ENTER_GAMES_SHUTDOWN_CLOSED=32, ENTER_GAMES_WHILE_MOVING=64, CHANGE_STATE_ACCEL_PRESSED=128.
Bits: 48..56
Sourcepub const fn set_state_transition_error_checked(
&mut self,
value: u8,
) -> Result<(), ()>
pub const fn set_state_transition_error_checked( &mut self, value: u8, ) -> Result<(), ()>
Bitmask of the most recent state-transition rejection reason(s). 0 = OK.
Bits map to state_transition_error_t in u_statemachine.h: REVERSE_DISABLED=1, DRIVE_FROM_FAULT=2, ENTER_DRIVE_DISABLED=4, ENTER_DRIVE_SHUTDOWN_OPEN=8, ENTER_DRIVE_BREAKS_NOT_ENGAGED=16, ENTER_GAMES_SHUTDOWN_CLOSED=32, ENTER_GAMES_WHILE_MOVING=64, CHANGE_STATE_ACCEL_PRESSED=128.
Bits: 48..56
Source§impl CarState
impl CarState
Sourcepub fn try_with_car_speed(self, v: f32) -> Result<Self, OutOfRange>
pub fn try_with_car_speed(self, v: f32) -> Result<Self, OutOfRange>
Like Self::with_car_speed but returns
OutOfRange instead of saturating an unrepresentable value.
Sourcepub fn try_set_car_speed(&mut self, v: f32) -> Result<(), OutOfRange>
pub fn try_set_car_speed(&mut self, v: f32) -> Result<(), OutOfRange>
Like Self::set_car_speed but returns
OutOfRange instead of saturating an unrepresentable value.
Sourcepub fn try_with_torque_limit_percentage(
self,
v: f32,
) -> Result<Self, OutOfRange>
pub fn try_with_torque_limit_percentage( self, v: f32, ) -> Result<Self, OutOfRange>
Like Self::with_torque_limit_percentage but returns
OutOfRange instead of saturating an unrepresentable value.
Sourcepub fn try_set_torque_limit_percentage(
&mut self,
v: f32,
) -> Result<(), OutOfRange>
pub fn try_set_torque_limit_percentage( &mut self, v: f32, ) -> Result<(), OutOfRange>
Like Self::set_torque_limit_percentage but returns
OutOfRange instead of saturating an unrepresentable value.