[−][src]Struct ht16k33::HT16K33
The HT16K33 state and configuration.
Methods
impl<I2C, E> HT16K33<I2C> where
I2C: Write<Error = E> + WriteRead<Error = E>,
[src]
I2C: Write<Error = E> + WriteRead<Error = E>,
pub fn new(i2c: I2C, address: u8) -> Self
[src]
Create an HT16K33 driver.
Arguments
i2c
- The I2C device to communicate with the HT16K33 chip.
Examples
use ht16k33::i2c_mock::I2cMock; use ht16k33::HT16K33; // Create an I2C device. let mut i2c = I2cMock::new(); // The I2C device address. let address = 0u8; let mut ht16k33 = HT16K33::new(i2c, address);
pub fn initialize(&mut self) -> Result<(), E>
[src]
Initialize the HT16K33.
Examples
let mut ht16k33 = HT16K33::new(i2c, address); ht16k33.initialize()?;
pub fn destroy(self) -> I2C
[src]
Return the given I2C device, making this device unusable.
Examples
let mut ht16k33 = HT16K33::new(i2c, address); i2c = ht16k33.destroy();
pub fn display_buffer(&self) -> &[DisplayData; 16]
[src]
Return the current display buffer.
Examples
let mut ht16k33 = HT16K33::new(i2c, address); let &buffer = ht16k33.display_buffer();
pub fn oscillator(&self) -> &Oscillator
[src]
Return the current oscillator state.
Examples
let mut ht16k33 = HT16K33::new(i2c, address); let oscillator = ht16k33.oscillator();
pub fn display(&self) -> &Display
[src]
Return the current display state.
Examples
let mut ht16k33 = HT16K33::new(i2c, address); let display = ht16k33.display();
pub fn dimming(&self) -> &Dimming
[src]
Return the current dimming state.
Examples
let mut ht16k33 = HT16K33::new(i2c, address); let dimming = ht16k33.dimming();
pub fn update_display_buffer(&mut self, location: LedLocation, enabled: bool)
[src]
Enable/disable an LED address in the display buffer.
The buffer must be written using write_display_buffer() for the change to be displayed.
Arguments
location
- The LED location to update.enabled
- Set the LED on (true) or off (false).
Examples
use ht16k33::LedLocation; let mut ht16k33 = HT16K33::new(i2c, address); let led_location = LedLocation::new(0, 0)?; ht16k33.update_display_buffer(led_location, true);
pub fn clear_display_buffer(&mut self)
[src]
Clear contents of the display buffer.
The buffer must be written using write_display_buffer() for the change to be displayed.
Examples
let mut ht16k33 = HT16K33::new(i2c, address); ht16k33.clear_display_buffer();
pub fn set_oscillator(&mut self, oscillator: Oscillator) -> Result<(), E>
[src]
Control the oscillator.
Arguments
oscillator
- Set the oscillator On/Off.
Examples
use ht16k33::Oscillator; let mut ht16k33 = HT16K33::new(i2c, address); ht16k33.set_oscillator(Oscillator::ON)?;
pub fn set_display(&mut self, display: Display) -> Result<(), E>
[src]
Control the display.
Arguments
display
- Set the display On/Off.
Examples
use ht16k33::Display; let mut ht16k33 = HT16K33::new(i2c, address); ht16k33.set_display(Display::HALF_HZ)?;
pub fn set_dimming(&mut self, dimming: Dimming) -> Result<(), E>
[src]
Control the display dimming.
Arguments
dimming
- Set the dimming brightness.
Examples
use ht16k33::Dimming; let mut ht16k33 = HT16K33::new(i2c, address); ht16k33.set_dimming(Dimming::from_u8(4)?)?;
pub fn set_led(&mut self, location: LedLocation, enabled: bool) -> Result<(), E>
[src]
Control an LED.
Arguments
location
- The LED location to update.enabled
- Set the LED on (true) or off (false).
Examples
use ht16k33::LedLocation; let mut ht16k33 = HT16K33::new(i2c, address); let led_location = LedLocation::new(0, 0)?; ht16k33.set_led(led_location, true)?;
pub fn write_display_buffer(&mut self) -> Result<(), E>
[src]
Write the display buffer to the HT16K33 chip.
Examples
let mut ht16k33 = HT16K33::new(i2c, address); ht16k33.write_display_buffer();
pub fn read_display_buffer(&mut self) -> Result<(), E>
[src]
Read the display buffer from the HT16K33 chip.
Examples
let mut ht16k33 = HT16K33::new(i2c, address); ht16k33.read_display_buffer();
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,