[][src]Crate ht16k33

HT16K33

ht16k33 is a driver for the Holtek HT16K33 RAM Mapping 16*8 LED Controller Driver with keyscan chip.

Currently, only the 28-pin SOP package type is supported.

Features

  • [x] Uses the embedded-hal hardware abstraction.
  • [x] Supports no_std for embedded devices.
  • [ ] Supports all 20/24/28-pin SOP package types.
  • [x] Displays all 128 LEDs.
  • [ ] Reads keyscan.
  • [ ] Manages interrupts.
  • [ ] Manages slave devices.

Usage

Linux-based platforms

Using the recommended linux-embedded-hal crate which implements the embedded-hal traits for Linux devices, including I2C.

This example is not tested
use linux_embedded_hal::I2cdev;
use ht16k33::HT16K33;

// The I2C device address.
let address = 112u8;

// Create an I2C device.
let mut i2c = I2cdev::new("/path/to/i2c/device")?;
i2c.set_slave_address(address as u16)?;

let mut ht16k33 = HT16K33::new(i2c, address);

Embedded platforms

Using this crate without default features in your Cargo.toml like so:

[dependencies]
htk16k33 = { version = "*", features = [] }

All platforms, using I2C simulation

Not all platforms have I2C support. The provided ht16k33::i2c_mock implements the embedded-hal traits for I2C.

use ht16k33::i2c_mock::I2cMock;
use ht16k33::HT16K33;

// The I2C device address.
let address = 112u8;

// Create a mock I2C device.
let mut i2c = I2cMock::new();

let mut ht16k33 = HT16K33::new(i2c, address);

Modules

i2c_mock

i2c_mock

Structs

Dimming

Display dimming.

Display

The LED display state.

DisplayData

RAM data for LED display.

DisplayDataAddress

Display RAM data address.

HT16K33

The HT16K33 state and configuration.

LedLocation

Represents the LED location.

Oscillator

System oscillator setup and control.

Enums

ValidationError

Errors encountered during validation.

Constants

COMMONS_SIZE

The number of COMMONS available.

ROWS_SIZE

The number of ROWS available (28-pin).