MAX7219 Module¶
This Module exposes all functionalities of Maxim MAX7219 Led Display driver ([datasheet(https://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf)).
class MAX7219¶
class MAX7219(spidrv,cs,clk=1000000)
Creates an intance of a new MAX7219.
Arguments:
- spidrv – SPI Bus used ‘( SPI0, … )’
- cs – Chip Select
- clk – Clock speed, default 100kHz
Example:
from maxim.max7219 import max7219
...
display = max7219.MAX7219(SPI0, D17)
display.set_led(row, col, 1) # set to on the led in 0x0 position
MAX7219.shutdown¶
shutdown(powerdown)
Function to shutdown the display attached
Arguments:
- powerdown – Boolean
True
orFalse
MAX7219.set_scan_limit¶
set_scan_limit(limit) *only for 7-segments Display*
Method that is used for seven segment displays that limits the number of digits.
Arguments:
- limit – number of banks (values 0 to 7).
MAX7219.set_intensity¶
set_intensity(intensity)
Sets the intensity of the LEDs output.
Arguments:
- intensity – light output intensity (values 0 to 15).
MAX7219.clear_display¶
clear_display()
Clears the display by setting all LEDs to 0.
MAX7219.set_led¶
set_led(row,column,state)
Allows the control of a single LED.
Arguments:
- row – is the row (values 0 to 7)
- column – is the column (values 0 to 7)
- state – is
True
for Led ON, andFalse
for Led OFF
MAX7219.set_row¶
set_row(row,state)
Sets an entire row.
Arguments:
- row – row to control (values from 0 to 7)
- state – is
True
for Led ON, andFalse
for Led OFF
MAX7219.set_column¶
set_column(col, state)
Sets an entire column.
Arguments:
- column – column to control (values from 0 to 7)
- state – is
True
for Led ON, andFalse
for Led OFF
MAX7219.set_digit¶
set_digit(digit,value,dp) *only for 7-segments Display*
Used with 7 segment displays to set a digit to display on the 7 segments.
Arguments:
- digit – is the bank from 0 to 7 to display
- value – is the number value
- dp – is the decimal point
MAX7219.set_char¶
set_char(dev_num,digit,value,state) *only for 7-segments Display*
Arguments:
- digit – is the bank from 0 to 7 to display
- value – is the character value
- state – is
True
for Led ON, andFalse
for Led OFF