Struct sensehat::SenseHat [−][src]
pub struct SenseHat<'a> { /* fields omitted */ }
Represents the Sense HAT itself.
Methods
impl<'a> SenseHat<'a>
[src]
impl<'a> SenseHat<'a>
pub fn new() -> SenseHatResult<SenseHat<'a>>
[src]
pub fn new() -> SenseHatResult<SenseHat<'a>>
Try and create a new SenseHat object.
Will open the relevant I2C devices and then attempt to initialise the chips on the Sense HAT.
pub fn get_temperature_from_pressure(&mut self) -> SenseHatResult<Temperature>
[src]
pub fn get_temperature_from_pressure(&mut self) -> SenseHatResult<Temperature>
Returns a Temperature reading from the barometer. It's less accurate than the barometer (+/- 2 degrees C), but over a wider range.
pub fn get_pressure(&mut self) -> SenseHatResult<Pressure>
[src]
pub fn get_pressure(&mut self) -> SenseHatResult<Pressure>
Returns a Pressure value from the barometer
pub fn get_temperature_from_humidity(&mut self) -> SenseHatResult<Temperature>
[src]
pub fn get_temperature_from_humidity(&mut self) -> SenseHatResult<Temperature>
Returns a Temperature reading from the humidity sensor. It's more accurate than the barometer (+/- 0.5 degrees C), but over a smaller range.
pub fn get_humidity(&mut self) -> SenseHatResult<RelativeHumidity>
[src]
pub fn get_humidity(&mut self) -> SenseHatResult<RelativeHumidity>
Returns a RelativeHumidity value in percent between 0 and 100
pub fn get_orientation(&mut self) -> SenseHatResult<Orientation>
[src]
pub fn get_orientation(&mut self) -> SenseHatResult<Orientation>
Returns a vector representing the current orientation, using all three sensors.
pub fn get_compass(&mut self) -> SenseHatResult<Angle>
[src]
pub fn get_compass(&mut self) -> SenseHatResult<Angle>
Get the compass heading (ignoring gyro and magnetometer)
pub fn get_gyro(&mut self) -> SenseHatResult<Orientation>
[src]
pub fn get_gyro(&mut self) -> SenseHatResult<Orientation>
Returns a vector representing the current orientation using only the gyroscope.
pub fn get_accel(&mut self) -> SenseHatResult<Orientation>
[src]
pub fn get_accel(&mut self) -> SenseHatResult<Orientation>
Returns a vector representing the current orientation using only the accelerometer.
pub fn get_accel_raw(&mut self) -> SenseHatResult<Vector3D>
[src]
pub fn get_accel_raw(&mut self) -> SenseHatResult<Vector3D>
Returns a vector representing the current acceleration in Gs.
pub fn show_message<INT, FG, BG>(
&mut self,
message: &str,
interval: INT,
fg: FG,
bg: BG
) -> SenseHatResult<()> where
INT: Into<Duration>,
FG: Into<Colour>,
BG: Into<Colour>,
[src]
pub fn show_message<INT, FG, BG>(
&mut self,
message: &str,
interval: INT,
fg: FG,
bg: BG
) -> SenseHatResult<()> where
INT: Into<Duration>,
FG: Into<Colour>,
BG: Into<Colour>,
Displays a scrolling message on the LED matrix. Blocks until the entire message has scrolled past.
The interval
can be a std::time::Duration
or an Fps
(frames per
second).
The fg
and bg
values set the foreground and background colours.
You can either specify:
- a constant colour like
Colour::WHITE
, - a string from the W3C basic keywords like
"white"
or"purple"
, or - an RGB 8-bit triple like
(0, 0xFF, 0)
.
pub fn text<FG, BG>(
&mut self,
message: &str,
fg: FG,
bg: BG
) -> SenseHatResult<()> where
FG: Into<Colour>,
BG: Into<Colour>,
[src]
pub fn text<FG, BG>(
&mut self,
message: &str,
fg: FG,
bg: BG
) -> SenseHatResult<()> where
FG: Into<Colour>,
BG: Into<Colour>,
Displays a scrolling message on the LED matrix. Blocks until the entire message has scrolled past. Scrolls at a fixed 10 frames per second.
The fg
and bg
values set the foreground and background colours.
You can either specify:
- a constant colour like
Colour::WHITE
, - a string from the W3C basic keywords like
"white"
or"purple"
, or - an RGB 8-bit triple like
(0, 0xFF, 0)
.
pub fn clear(&mut self) -> SenseHatResult<()>
[src]
pub fn clear(&mut self) -> SenseHatResult<()>
Clears the LED matrix