Ht16k33Multi.Display (ht16k33_multi v0.2.0)

View Source

Commands for controlling a 7-segment display using the Ht16k33.

For detailed information, refer to the official Ht16k33 datasheet: https://www.holtek.com/webapi/116711/HT16K33Av102.pdf

These commands must be sent via the I2C bus to interact with the device. For example:

command = Display.blincking_off()
Circuits.I2C.write(ref, 0x70, <<command>>)

or

Display.blincking_off() |> I2cBus.write(%Ht16k33{} = state)

💡 To simplify usage, please use the Ht16k33Multi GenServer module, such as calling Ht16k33Multi.blinking_on() for ease of interaction.

💡 Note: The display needs to be initialized before anything can be shown. For initialization instructions, please refer to the documentation for Ht16k33Multi.Display.initialize/0.

Display positions and colon

The display uses specific positions to control the segments and colon:

Position | A   B  :  C  D  |
         |-----------------|
Display  | 8.  8. :  8. 8. |
PositionHex Register
A0x00
B0x02
: (colon)0x04
C0x06
D0x08

Summary

Functions

Retrieve all display position values as a list, based on this module documentation (Ht16k33Multi.Display).

Command to turn off blinking on the display.

Command to activate blinking on the display with adjustable speed.

Clear the display by turning off all LED segments.

Command to turn the colon off.

Command to turn the colon on.

Command to turn the display off.

Command to turn the display on.

Initialize the display by enabling the oscillation, turning the display on, and ensuring the colon is off for a clean display of text.

Command to start the oscillation, which is necessary for initialization.

Functions

all_positions()

(since 0.1.0)
@spec all_positions() :: list()

Retrieve all display position values as a list, based on this module documentation (Ht16k33Multi.Display).

blinking_off()

(since 0.1.0)
@spec blinking_off() :: 129

Command to turn off blinking on the display.

blinking_on(speed \\ 0)

(since 0.1.0)
@spec blinking_on(any()) :: 131 | 133 | 135

Command to activate blinking on the display with adjustable speed.

The default blinking speed is 0.5 Hz.

  • speed – The blinking speed:
    • 0 – 0.5 Hz
    • 1 – 1 Hz
    • 2 – 2 Hz

clear()

(since 0.1.0)
@spec clear() :: binary()

Clear the display by turning off all LED segments.

colon_off()

(since 0.1.0)
@spec colon_off() :: <<_::16>>

Command to turn the colon off.

colon_on()

(since 0.1.0)
@spec colon_on() :: <<_::16>>

Command to turn the colon on.

display_off()

(since 0.1.0)
@spec display_off() :: 128

Command to turn the display off.

display_on()

(since 0.1.0)
@spec display_on() :: 129

Command to turn the display on.

initialize()

(since 0.1.0)
@spec initialize() :: [<<_::16>> | 33 | 129, ...]

Initialize the display by enabling the oscillation, turning the display on, and ensuring the colon is off for a clean display of text.

This is required to begin displaying something on the Ht16k33.

oscillation_on()

(since 0.1.0)
@spec oscillation_on() :: 33

Command to start the oscillation, which is necessary for initialization.