Ht16k33Multi.Display (ht16k33_multi v0.2.2)
View SourceCommands 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)
use Ht16k33Multi
To simplify usage, please use the Ht16k33Multi
GenServer module,
such as calling Ht16k33Multi.blinking_on()
for ease of interaction.
Display needs to be initialized
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. |
Position | Hex Register |
---|---|
A | 0x00 |
B | 0x02 |
: (colon) | 0x04 |
C | 0x06 |
D | 0x08 |
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 and all LED segments are off for a clean display of text.
Command to start the oscillation, which is necessary for initialization.
Functions
@spec all_positions() :: list()
Retrieve all display position values as a list,
based on this module documentation (Ht16k33Multi.Display
).
@spec blinking_off() :: 129
Command to turn off blinking on the display.
@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 Hz1
– 1 Hz2
– 2 Hz
@spec clear() :: binary()
Clear the display by turning off all LED segments.
@spec colon_off() :: <<_::16>>
Command to turn the colon off.
@spec colon_on() :: <<_::16>>
Command to turn the colon on.
@spec display_off() :: 128
Command to turn the display off.
@spec display_on() :: 129
Command to turn the display on.
@spec initialize() :: [<<_::16>> | 33 | 129, ...]
Initialize the display by enabling the oscillation, turning the display on, and ensuring the colon and all LED segments are off for a clean display of text.
This is required to begin displaying something on the Ht16k33
.
@spec oscillation_on() :: 33
Command to start the oscillation, which is necessary for initialization.