From 04741e9396b5d315639c205441ae64a343e16018 Mon Sep 17 00:00:00 2001 From: Tropical <42101043+Tropix126@users.noreply.github.com> Date: Sun, 31 Mar 2024 20:57:25 -0500 Subject: [PATCH] feat: controller update rate constant --- packages/vex-devices/src/controller.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/vex-devices/src/controller.rs b/packages/vex-devices/src/controller.rs index 32fd6f49..55f55adc 100644 --- a/packages/vex-devices/src/controller.rs +++ b/packages/vex-devices/src/controller.rs @@ -2,6 +2,8 @@ //! //! Controllers are identified by their id, which is either 0 (master) or 1 (partner). //! State of a controller can be checked by calling [`Controller::state`] which will return a struct with all of the buttons' and joysticks' state. +use core::time::Duration; + use alloc::ffi::CString; use snafu::Snafu; @@ -253,6 +255,9 @@ impl From for V5_ControllerId { } impl Controller { + /// The update rate of the controller. + pub const UPDATE_RATE: Duration = Duration::from_millis(25); + fn validate(&self) -> Result<(), ControllerError> { if !controller_connected(self.id) { return Err(ControllerError::NotConnected);