PCA9622Matrix8x8 (pca9622matrix8x8 v0.1.3)
Copy MarkdownDriver for the switch-science "I2C 8x8 LED matrix" board (https://www.switch-science.com/products/2071), which multiplexes an 8x8 LED matrix over I2C using the PCA9622 constant-current LED driver.
start_link/1 accepts:
:bus_name- the I2C bus to open (default:"i2c-2"):i2c_address- the PCA9622's I2C address (default:0x50):reflesh_interval- column refresh interval in ms (default:10):initial_matrix- initial 8x8 matrix to display:name- GenServer name to register under (default:PCA9622Matrix8x8); passnilto start unnamed, which allows multiple boards to run at once. When a name other than the default is used (ornil), pass the returned pid/name explicitly toset_matrix/2,set_matrix_bit/4andstop/1.
Summary
Functions
Turns every LED on the board fully off. Takes a raw I2C ref (from
Circuits.I2C.open/1 or init_led/2), not a GenServer.
Turns every LED on the board fully on. Takes a raw I2C ref (from
Circuits.I2C.open/1 or init_led/2), not a GenServer. Useful as a quick
hardware sanity check.
Returns a specification to start this module under a supervisor.
Replaces the whole 8x8 matrix that is currently displayed.
Builds an 8x8 matrix (as used by set_matrix/2) with every pixel set to
value. value may be 0/1, or any other term treated as falsy/truthy.
Sets a single pixel (x, y) of the currently displayed matrix to value
(0 or 1).
Starts the LED matrix driver GenServer. See the moduledoc for available
opts.
Stops the LED matrix driver GenServer, turning all LEDs off and closing the I2C bus.
Functions
Turns every LED on the board fully off. Takes a raw I2C ref (from
Circuits.I2C.open/1 or init_led/2), not a GenServer.
Turns every LED on the board fully on. Takes a raw I2C ref (from
Circuits.I2C.open/1 or init_led/2), not a GenServer. Useful as a quick
hardware sanity check.
Returns a specification to start this module under a supervisor.
See Supervisor.
Replaces the whole 8x8 matrix that is currently displayed.
mat is an 8x8 tuple of tuples of 0/1, e.g. as built from
PCA9622Matrix8x8.CharGen.digit_strlist/2 output.
Builds an 8x8 matrix (as used by set_matrix/2) with every pixel set to
value. value may be 0/1, or any other term treated as falsy/truthy.
Sets a single pixel (x, y) of the currently displayed matrix to value
(0 or 1).
Starts the LED matrix driver GenServer. See the moduledoc for available
opts.
Stops the LED matrix driver GenServer, turning all LEDs off and closing the I2C bus.