Enum rcx::SensorMode
source · #[repr(u8)]pub enum SensorMode {
Raw = 0,
Boolean = 1,
EdgeCount = 2,
PulseCount = 3,
Percentage = 4,
TemperatureC = 5,
TemperatureF = 6,
Angle = 7,
}
Expand description
Set the slope and mode of sensor number sensor to the value specified by mode, and clear that sensor’s value. The bits of mode are split into two portions. Bits 0-4 contain a slope value in 0..31, while bits 5-7 contain the mode, 0..7. The eight modes, which control the value returned by the sensor, are:
Mode Name Description
0 Raw Value in 0..1023.
1 Boolean Either 0 or 1.
2 Edge count Number of boolean transitions.
3 Pulse count Number of boolean transitions divided by two.
4 Percentage Raw value scaled to 0..100.
5 Temperature in °C 1/10ths of a degree, -19.8..69.5.
6 Temperature in °F 1/10ths of a degree, -3.6..157.1.
7 Angle 1/16ths of a rotation, represented as a signed short.
The slope value controls 0/1 detection for the three boolean modes. A slope of 0 causes raw sensor values greater than 562 to cause a transition to 0 and raw sensor values less than 460 to cause a transition to 1. The hysteresis prevents bouncing between 0 and 1 near the transition point. A slope value in 1..31, inclusive, causes a transition to 0 or to 1 whenever the difference between consecutive raw sensor values exceeds the slope. Increases larger than the slope result in 0 transitions, while decreases larger than the slope result in 1 transitions. Note the inversions: high raw values correspond to a boolean 0, while low raw values correspond to a boolean 1.
Variants§
Raw = 0
Boolean = 1
EdgeCount = 2
PulseCount = 3
Percentage = 4
TemperatureC = 5
TemperatureF = 6
Angle = 7
Trait Implementations§
source§impl Clone for SensorMode
impl Clone for SensorMode
source§fn clone(&self) -> SensorMode
fn clone(&self) -> SensorMode
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SensorMode
impl Debug for SensorMode
source§impl PartialEq for SensorMode
impl PartialEq for SensorMode
source§fn eq(&self, other: &SensorMode) -> bool
fn eq(&self, other: &SensorMode) -> bool
self
and other
values to be equal, and is used
by ==
.