[−][src]Trait adafruit_7segment::SevenSegment
Trait enabling using the Adafruit 7-segment LED numeric Backpack.
Required methods
fn update_buffer_with_digit(&mut self, index: Index, value: u8)
Update the buffer with a digit value (0 to F) at the specified index.
fn update_buffer_with_dot(&mut self, index: Index, dot_on: bool)
Update the buffer to turn the . on or off at the specified index.
fn update_buffer_with_colon(&mut self, colon_on: bool)
Update the buffer to turn the : on or off.
fn update_buffer_with_char(
&mut self,
index: Index,
value: AsciiChar
) -> Result<(), Error>
&mut self,
index: Index,
value: AsciiChar
) -> Result<(), Error>
Update the buffer with an ascii character at the specified index.
fn update_buffer_with_float(
&mut self,
index: Index,
value: f32,
fractional_digits: u8,
base: u8
) -> Result<(), Error>
&mut self,
index: Index,
value: f32,
fractional_digits: u8,
base: u8
) -> Result<(), Error>
Update the buffer with a formatted float not starting before the specified index.
Implementations on Foreign Types
impl<I2C, E> SevenSegment<E> for HT16K33<I2C> where
I2C: Write<Error = E> + WriteRead<Error = E>,
[src]
I2C: Write<Error = E> + WriteRead<Error = E>,
fn update_buffer_with_digit(&mut self, index: Index, value: u8)
[src]
Update the buffer with a hex digit value (0x00 to 0x0F) at the specified index
Arguments
index
- Digit index.value
- Value 0x00 to 0x0F.
Examples
use ht16k33::i2c_mock::I2cMock; use ht16k33::HT16K33; use adafruit_7segment::{SevenSegment, Index}; // Create an I2C device. let mut i2c = I2cMock::new(); // The I2C device address. const DISP_I2C_ADDR: u8 = 112; let mut ht16k33 = HT16K33::new(i2c, DISP_I2C_ADDR); // Set first digit to 9. ht16k33.update_buffer_with_digit(Index::One, 9);
fn update_buffer_with_dot(&mut self, index: Index, dot_on: bool)
[src]
Update the buffer to turn the . on or off at the specified index
Arguments
index
- Digit index.dot_on
- Enable or disable the dot.
Examples
use ht16k33::i2c_mock::I2cMock; use ht16k33::HT16K33; use adafruit_7segment::{SevenSegment, Index}; // Create an I2C device. let mut i2c = I2cMock::new(); // The I2C device address. const DISP_I2C_ADDR: u8 = 112; let mut ht16k33 = HT16K33::new(i2c, DISP_I2C_ADDR); // Enable dot for first digit. ht16k33.update_buffer_with_dot(Index::One, true);
fn update_buffer_with_colon(&mut self, colon_on: bool)
[src]
Update the buffer to turn the : on or off.
Arguments
colon_on
- Enable or disable the colon.
Examples
use ht16k33::i2c_mock::I2cMock; use ht16k33::HT16K33; use adafruit_7segment::{SevenSegment, Index}; // Create an I2C device. let mut i2c = I2cMock::new(); // The I2C device address. const DISP_I2C_ADDR: u8 = 112; let mut ht16k33 = HT16K33::new(i2c, DISP_I2C_ADDR); // Enable the colon. ht16k33.update_buffer_with_colon(true);
fn update_buffer_with_char(
&mut self,
index: Index,
value: AsciiChar
) -> Result<(), Error>
[src]
&mut self,
index: Index,
value: AsciiChar
) -> Result<(), Error>
Update the buffer with an ascii character at the specified index.
Arguments
index
- Digit index.value
- Ascii character.
Examples
use ht16k33::i2c_mock::I2cMock; use ht16k33::HT16K33; use adafruit_7segment::{SevenSegment, Index, AsciiChar}; // Create an I2C device. let mut i2c = I2cMock::new(); // The I2C device address. const DISP_I2C_ADDR: u8 = 112; let mut ht16k33 = HT16K33::new(i2c, DISP_I2C_ADDR); // Set first digit to 'c'. ht16k33.update_buffer_with_char(Index::One, AsciiChar::new('c')).expect("Failed to encode char to buffer!");
fn update_buffer_with_float(
&mut self,
index: Index,
value: f32,
fractional_digits: u8,
base: u8
) -> Result<(), Error>
[src]
&mut self,
index: Index,
value: f32,
fractional_digits: u8,
base: u8
) -> Result<(), Error>
Update the buffer with a formatted float not starting before the specified index The logic for this is copied mostly from from the adafruit library. Only difference is this allows the start index to be > 0
Arguments
index
- Digit index.value
- float value.fractional_digits
- Number of fractional digits.base
- Base to use.
Examples
use ht16k33::i2c_mock::I2cMock; use ht16k33::HT16K33; use adafruit_7segment::{SevenSegment, Index}; // Create an I2C device. let mut i2c = I2cMock::new(); // The I2C device address. const DISP_I2C_ADDR: u8 = 112; let mut ht16k33 = HT16K33::new(i2c, DISP_I2C_ADDR); // Write 9.9 from pos 2 ht16k33.update_buffer_with_float(Index::Two, 9.9, 1, 10);