SevSegI2c

Struct SevSegI2c 

Source
pub struct SevSegI2c<I2C> { /* private fields */ }

Implementations§

Source§

impl<I2C> SevSegI2c<I2C>
where I2C: Write,

Source

pub fn new(i2c: I2C, addr: Option<u8>) -> Self

Create a new SparkFun Serial Seven Segment display using an I2C port. The I2C port supports 100kHz and 400kHz modes.

If no address is supplied, the default 7-bit address of 0x71 will be used.

Source

pub fn set_address(&mut self, addr: u8)

Update the address of the display used by the library.

This does NOT reconfigure the display to use this new address.

For now, this is probably not useful until we implement the “change address” command in the main interface.

Source

pub fn release(self) -> I2C

Release the components

Trait Implementations§

Source§

impl<I2C> SevenSegInterface for SevSegI2c<I2C>
where I2C: Write,

Source§

type InterfaceError = I2cError<<I2C as Write>::Error>

A single error type used by the interface
Source§

fn send(&mut self, data: &[u8]) -> Result<(), Error<Self::InterfaceError>>

Sending commands to the interface
Source§

fn set_cursor(&mut self, col: u8) -> Result<(), Error<Self::InterfaceError>>

Set the digit cursor to a particular location col may be 0..=3, from left to right.
Source§

fn set_brightness( &mut self, bright: u8, ) -> Result<(), Error<Self::InterfaceError>>

Set the brightness for the display. The datasheet says that 100 is the brightest, however my device gets brighter with values above 100 (up to 255). Your mileage may vary.
Source§

fn clear(&mut self) -> Result<(), Error<Self::InterfaceError>>

Completely clear the display
Source§

fn write_digit(&mut self, digit: u8) -> Result<(), Error<Self::InterfaceError>>

Write a digit to the curent cursor position. This also increments the cursor position
Source§

fn write_punctuation( &mut self, punct_flags: PunctuationFlags, ) -> Result<(), Error<Self::InterfaceError>>

Write the requested punctuation to the display. This does not take the current state into account, so any unset flags in punct_flags will turn the corresponding LEDs off.
Source§

fn write_digits( &mut self, digits: &[u8], ) -> Result<(), Error<Self::InterfaceError>>

Write the requested digits to the display, starting at the current cursor position. Each digit must be in the range 0x0..=0xF, and up to 4 digits may be updated at once. The cursor is incremented after each digit
Source§

fn set_num(&mut self, num: u16) -> Result<(), Error<Self::InterfaceError>>

Write the number to the display. The number will be left-filled with zeroes if necessary. After this function, the cursor will be at position 0.

Auto Trait Implementations§

§

impl<I2C> Freeze for SevSegI2c<I2C>
where I2C: Freeze,

§

impl<I2C> RefUnwindSafe for SevSegI2c<I2C>
where I2C: RefUnwindSafe,

§

impl<I2C> Send for SevSegI2c<I2C>
where I2C: Send,

§

impl<I2C> Sync for SevSegI2c<I2C>
where I2C: Sync,

§

impl<I2C> Unpin for SevSegI2c<I2C>
where I2C: Unpin,

§

impl<I2C> UnwindSafe for SevSegI2c<I2C>
where I2C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.