CarState

Struct CarState 

Source
pub struct CarState(/* private fields */);

Implementations§

Source§

impl CarState

Source

pub const fn new() -> Self

Creates a new default initialized bitfield.

Source

pub const fn from_bits(bits: u64) -> Self

Convert from bits.

Source

pub const fn into_bits(self) -> u64

Convert into bits.

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub const fn car_speed(&self) -> f32

Speed of the car, in miles per hour.

Units: mph

Bits: 8..24

Source

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

Source

pub const fn with_car_speed(self, value: f32) -> Self

Speed of the car, in miles per hour.

Units: mph

Bits: 8..24

Source

pub const fn set_car_speed(&mut self, value: f32)

Speed of the car, in miles per hour.

Units: mph

Bits: 8..24

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub const fn torque_limit_percentage(&self) -> f32

The torque limit selected by the driver.

Bits: 25..32

Source

pub const fn with_torque_limit_percentage_checked( self, value: f32, ) -> Result<Self, ()>

The torque limit selected by the driver.

Bits: 25..32

Source

pub const fn with_torque_limit_percentage(self, value: f32) -> Self

The torque limit selected by the driver.

Bits: 25..32

Source

pub const fn set_torque_limit_percentage(&mut self, value: f32)

The torque limit selected by the driver.

Bits: 25..32

Source

pub const fn set_torque_limit_percentage_checked( &mut self, value: f32, ) -> Result<(), ()>

The torque limit selected by the driver.

Bits: 25..32

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub const fn regen_limit(&self) -> u16

The regenerative braking current limit (selected by the driver).

Units: A

Bits: 33..43

Source

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

Source

pub const fn with_regen_limit(self, value: u16) -> Self

The regenerative braking current limit (selected by the driver).

Units: A

Bits: 33..43

Source

pub const fn set_regen_limit(&mut self, value: u16)

The regenerative braking current limit (selected by the driver).

Units: A

Bits: 33..43

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for CarState

Source§

fn clone(&self) -> CarState

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CarState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CarState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<CarState> for u64

Source§

fn from(v: CarState) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for CarState

Source§

fn from(v: u64) -> Self

Converts to this type from the input type.
Source§

impl ToCanFrame for CarState

Source§

const LEN: usize = 7usize

Source§

const ID: Id

Source§

type Repr = u64

Source§

fn to_can_frame<F: Frame>(self) -> F

Source§

impl Copy for CarState

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.