MAX7219 Module

This Module exposes all functionalities of Maxim MAX7219 Led Display driver (datasheet).
class MAX7219(spidrv, cs, clk=1000000)

Creates an intance of a new MAX7219.

Parameters:
  • 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
shutdown(powerdown)

Function to shutdown the display attached

Parameters:powerdown – Boolean True or False
set_scan_limit(limit) *only for 7-segments Display*

Method that is used for seven segment displays that limits the number of digits.

Parameters:limit – number of banks (values 0 to 7).
set_intensity(intensity)

Sets the intensity of the LEDs output.

Parameters:intensity – light output intensity (values 0 to 15).
clear_display()

Clears the display by setting all LEDs to 0.

set_led(row, column, state)

Allows the control of a single LED.

Parameters:
  • row – is the row (values 0 to 7)
  • column – is the column (values 0 to 7)
  • state – is True for Led ON, and False for Led OFF
set_row(row, state)

Sets an entire row.

Parameters:
  • row – row to control (values from 0 to 7)
  • state – is True for Led ON, and False for Led OFF
set_column(col, state)

Sets an entire column.

Parameters:
  • column – column to control (values from 0 to 7)
  • state – is True for Led ON, and False for Led OFF
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.

Parameters:
  • digit – is the bank from 0 to 7 to display
  • value – is the number value
  • dp – is the decimal point
set_char(dev_num, digit, value, state) *only for 7-segments Display*
Parameters:
  • digit – is the bank from 0 to 7 to display
  • value – is the character value
  • state – is True for Led ON, and False for Led OFF