Struct eight_segment::EightSegment[][src]

pub struct EightSegment<'a> {
    pub high_on: bool,
    pub seg_a: &'a mut OutputPin,
    pub seg_b: &'a mut OutputPin,
    pub seg_c: &'a mut OutputPin,
    pub seg_d: &'a mut OutputPin,
    pub seg_e: &'a mut OutputPin,
    pub seg_f: &'a mut OutputPin,
    pub seg_g: &'a mut OutputPin,
    pub seg_p: &'a mut OutputPin,
}

An eight segment display that can display a single digit from 0x0 to 0xF at a time. Intended for use with the HDSP-H101 and HDSP-H103.

The labels on the segments are as described in the H101 and H103 datasheet:

    _______
   |   a   |
   |f     b|
   |   g   |
   |-------|
   |e     c|
   |   d   |
   '-------'  .
              p

Some like the H101 have the segment turned on being pin-low, and some like the H103 have on being pin-high. Set the high_on boolean as appropriate.

Examples

This example is not tested
    // in this case using the `atsamd21_hal` library to provide access to the pins
    // but any embedded-hal implementation should work
    let mut peripherals = Peripherals::take().unwrap();
    let mut pins = peripherals.PORT.split();
    let mut seg_a = pins.pa21.into_open_drain_output(&mut pins.port);
    let mut seg_b = pins.pa20.into_open_drain_output(&mut pins.port);
    let mut seg_c = pins.pa11.into_open_drain_output(&mut pins.port);
    let mut seg_d = pins.pb10.into_open_drain_output(&mut pins.port);
    let mut seg_e = pins.pb11.into_open_drain_output(&mut pins.port);
    let mut seg_f = pins.pa16.into_open_drain_output(&mut pins.port);
    let mut seg_g = pins.pa17.into_open_drain_output(&mut pins.port);
    let mut seg_p = pins.pa10.into_open_drain_output(&mut pins.port);
    let mut eight_segment = EightSegment {
        high_on: false,
        seg_a: &mut seg_a,
        seg_b: &mut seg_b,
        seg_c: &mut seg_c,
        seg_d: &mut seg_d,
        seg_e: &mut seg_e,
        seg_f: &mut seg_f,
        seg_g: &mut seg_g,
        seg_p: &mut seg_p,
    };
    eight_segment.blank(); // All segments off
    eight_segment.display(0xb, false); // Display 'b' with decimal point off

Fields

Methods

impl<'a> EightSegment<'a>
[src]

Auto Trait Implementations

impl<'a> !Send for EightSegment<'a>

impl<'a> !Sync for EightSegment<'a>