max7219 - Driver for 8-Digit LED display drivers, MAX7219/MAX7221

Warning

This component does not support (yet) ESP8266 RTOS SDK!

group max7219

ESP-IDF driver for MAX7219/MAX7221 Serially Interfaced, 8-Digit LED Display Drivers.

Ported from esp-open-rtos

Copyright (C) 2017, 2018 Ruslan V. Uss unclerus@gmail.com

BSD Licensed as described in the file LICENSE

Defines

MAX7219_MAX_CASCADE_SIZE
MAX7219_MAX_BRIGHTNESS

Functions

esp_err_t max7219_init_desc(max7219_t *dev, spi_host_device_t host, gpio_num_t cs_pin)

Initialize device descriptor.

Parameters
  • dev – Device descriptor

  • host – SPI host

  • cs_pin – CS GPIO number

Returns

ESP_OK on success

esp_err_t max7219_free_desc(max7219_t *dev)

Free device descriptor.

Parameters

dev – Device descriptor

Returns

ESP_OK on success

esp_err_t max7219_init(max7219_t *dev)

Initialize display.

Switch it to normal operation from shutdown mode, set scan limit to the max and clear

Parameters

dev – Display descriptor

Returns

ESP_OK on success

esp_err_t max7219_set_decode_mode(max7219_t *dev, bool bcd)

Set decode mode and clear display.

Parameters
  • dev – Display descriptor

  • bcd – true to set BCD decode mode, false to normal

Returns

ESP_OK on success

esp_err_t max7219_set_brightness(max7219_t *dev, uint8_t value)

Set display brightness.

Parameters
  • dev – Display descriptor

  • value – Brightness value, 0..MAX7219_MAX_BRIGHTNESS

Returns

ESP_OK on success

esp_err_t max7219_set_shutdown_mode(max7219_t *dev, bool shutdown)

Shutdown display or set it to normal mode.

Parameters
  • dev – Display descriptor

  • shutdown – Shutdown display if true

Returns

ESP_OK on success

esp_err_t max7219_set_digit(max7219_t *dev, uint8_t digit, uint8_t val)

Write data to display digit.

Parameters
  • dev – Display descriptor

  • digit – Digit index, 0..dev->digits - 1

  • val – Data

Returns

ESP_OK on success

esp_err_t max7219_clear(max7219_t *dev)

Clear display.

Parameters

dev – Display descriptor

Returns

ESP_OK on success

esp_err_t max7219_draw_text_7seg(max7219_t *dev, uint8_t pos, const char *s)

Draw text on 7-segment display.

Parameters
  • dev – Display descriptor

  • pos – Start digit

  • s – Text

Returns

ESP_OK on success

esp_err_t max7219_draw_image_8x8(max7219_t *dev, uint8_t pos, const void *image)

Draw 64-bit image on 8x8 matrix.

Parameters
  • dev – Display descriptor

  • pos – Start digit

  • image – 64-bit buffer with image data

Returns

ESP_OK on success

struct max7219_t
#include <max7219.h>

Display descriptor.