vexide_devices/
battery.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//! Utilities for getting information about the robot's battery.

use vex_sdk::{
    vexBatteryCapacityGet, vexBatteryCurrentGet, vexBatteryTemperatureGet, vexBatteryVoltageGet,
};

/// Get the robot's battery capacity.
/// TODO: Determine units
pub fn capacity() -> f64 {
    unsafe { vexBatteryCapacityGet() }
}

/// Get the current temperature of the robot's battery.
/// TODO: Determine units
pub fn temperature() -> f64 {
    unsafe { vexBatteryTemperatureGet() }
}

/// Get the electric current of the robot's battery.
/// TODO: Determine units
pub fn current() -> i32 {
    unsafe { vexBatteryCurrentGet() }
}

/// Get the robot's battery voltage.
/// TODO: Determine units
pub fn voltage() -> i32 {
    unsafe { vexBatteryVoltageGet() }
}