LibDriver MAX7219  2.0.0
MAX7219 full-featured driver
driver_max7219.h File Reference

driver max7219 header file More...

#include <stdio.h>
#include <stdint.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  max7219_cascade_s
 max7219 cascade structure definition More...
 
struct  max7219_handle_s
 max7219 handle structure definition More...
 
struct  max7219_info_s
 max7219 info structure definition More...
 

Macros

#define MAX7219_MAX_CASCADE_SIZE   128
 max7219 max cascade size definition More...
 
#define DRIVER_MAX7219_LINK_INIT(HANDLE, STRUCTURE)   memset(HANDLE, 0, sizeof(STRUCTURE))
 initialize max7219_handle_t structure More...
 
#define DRIVER_MAX7219_LINK_SPI_INIT(HANDLE, FUC)   (HANDLE)->spi_init = FUC
 link spi_init function More...
 
#define DRIVER_MAX7219_LINK_SPI_DEINIT(HANDLE, FUC)   (HANDLE)->spi_deinit = FUC
 link spi_deinit function More...
 
#define DRIVER_MAX7219_LINK_SPI_WRITE(HANDLE, FUC)   (HANDLE)->spi_write = FUC
 link spi_write function More...
 
#define DRIVER_MAX7219_LINK_SPI_WRITE_COMMAND(HANDLE, FUC)   (HANDLE)->spi_write_cmd = FUC
 link spi_write_cmd function More...
 
#define DRIVER_MAX7219_LINK_DELAY_MS(HANDLE, FUC)   (HANDLE)->delay_ms = FUC
 link delay_ms function More...
 
#define DRIVER_MAX7219_LINK_DEBUG_PRINT(HANDLE, FUC)   (HANDLE)->debug_print = FUC
 link debug_print function More...
 

Typedefs

typedef struct max7219_cascade_s max7219_cascade_t
 max7219 cascade structure definition More...
 
typedef struct max7219_handle_s max7219_handle_t
 max7219 handle structure definition More...
 
typedef struct max7219_info_s max7219_info_t
 max7219 info structure definition More...
 

Enumerations

enum  max7219_segment_t {
  MAX7219_SEGMENT_A = (1 << 6) , MAX7219_SEGMENT_B = (1 << 5) , MAX7219_SEGMENT_C = (1 << 4) , MAX7219_SEGMENT_D = (1 << 3) ,
  MAX7219_SEGMENT_E = (1 << 2) , MAX7219_SEGMENT_F = (1 << 1) , MAX7219_SEGMENT_G = (1 << 0) , MAX7219_SEGMENT_DP = (1 << 7)
}
 max7219 segment enumeration definition More...
 
enum  max7219_codeb_font_t {
  MAX7219_CODEB_FONT_0 = 0x00 , MAX7219_CODEB_FONT_1 = 0x01 , MAX7219_CODEB_FONT_2 = 0x02 , MAX7219_CODEB_FONT_3 = 0x03 ,
  MAX7219_CODEB_FONT_4 = 0x04 , MAX7219_CODEB_FONT_5 = 0x05 , MAX7219_CODEB_FONT_6 = 0x06 , MAX7219_CODEB_FONT_7 = 0x07 ,
  MAX7219_CODEB_FONT_8 = 0x08 , MAX7219_CODEB_FONT_9 = 0x09 , MAX7219_CODEB_FONT_LINE = 0x0A , MAX7219_CODEB_FONT_E = 0x0B ,
  MAX7219_CODEB_FONT_H = 0x0C , MAX7219_CODEB_FONT_L = 0x0D , MAX7219_CODEB_FONT_P = 0x0E , MAX7219_CODEB_FONT_BLACK = 0x0F
}
 max7219 code b font enumeration definition More...
 
enum  max7219_no_decode_font_t {
  MAX7219_NO_DECODE_FONT_0 = 0x7E , MAX7219_NO_DECODE_FONT_1 = 0x30 , MAX7219_NO_DECODE_FONT_2 = 0x6D , MAX7219_NO_DECODE_FONT_3 = 0x79 ,
  MAX7219_NO_DECODE_FONT_4 = 0x33 , MAX7219_NO_DECODE_FONT_5 = 0x5B , MAX7219_NO_DECODE_FONT_6 = 0x5F , MAX7219_NO_DECODE_FONT_7 = 0x70 ,
  MAX7219_NO_DECODE_FONT_8 = 0x7F , MAX7219_NO_DECODE_FONT_9 = 0x7B , MAX7219_NO_DECODE_FONT_LINE = 0x01 , MAX7219_NO_DECODE_FONT_E = 0x4F ,
  MAX7219_NO_DECODE_FONT_H = 0x37 , MAX7219_NO_DECODE_FONT_L = 0x0E , MAX7219_NO_DECODE_FONT_P = 0x67 , MAX7219_NO_DECODE_FONT_BLACK = 0x00
}
 max7219 no decode font enumeration definition More...
 
enum  max7219_scan_limit_t {
  MAX7219_SCAN_LIMIT_DIGIT_0_0 = 0x00 , MAX7219_SCAN_LIMIT_DIGIT_0_1 = 0x01 , MAX7219_SCAN_LIMIT_DIGIT_0_2 = 0x02 , MAX7219_SCAN_LIMIT_DIGIT_0_3 = 0x03 ,
  MAX7219_SCAN_LIMIT_DIGIT_0_4 = 0x04 , MAX7219_SCAN_LIMIT_DIGIT_0_5 = 0x05 , MAX7219_SCAN_LIMIT_DIGIT_0_6 = 0x06 , MAX7219_SCAN_LIMIT_DIGIT_0_7 = 0x07
}
 max7219 scan limit enumeration definition More...
 
enum  max7219_intensity_t {
  MAX7219_INTENSITY_1_32 = 0x00 , MAX7219_INTENSITY_3_32 = 0x01 , MAX7219_INTENSITY_5_32 = 0x02 , MAX7219_INTENSITY_7_32 = 0x03 ,
  MAX7219_INTENSITY_9_32 = 0x04 , MAX7219_INTENSITY_11_32 = 0x05 , MAX7219_INTENSITY_13_32 = 0x06 , MAX7219_INTENSITY_15_32 = 0x07 ,
  MAX7219_INTENSITY_17_32 = 0x08 , MAX7219_INTENSITY_19_32 = 0x09 , MAX7219_INTENSITY_21_32 = 0x0A , MAX7219_INTENSITY_23_32 = 0x0B ,
  MAX7219_INTENSITY_25_32 = 0x0C , MAX7219_INTENSITY_27_32 = 0x0D , MAX7219_INTENSITY_29_32 = 0x0E , MAX7219_INTENSITY_31_32 = 0x0F
}
 max7219 intensity enumeration definition More...
 
enum  max7219_mode_t { MAX7219_MODE_SHUT_DOWN = 0x00 , MAX7219_MODE_NORMAL = 0x01 }
 max7219 mode enumeration definition More...
 
enum  max7219_display_test_mode_t { MAX7219_DISPLAY_TEST_MODE_OFF = 0x00 , MAX7219_DISPLAY_TEST_MODE_ON = 0x01 }
 max7219 display test mode enumeration definition More...
 
enum  max7219_decode_t { MAX7219_DECODE_CODEB_DIGITS_NONE = 0x00 , MAX7219_DECODE_CODEB_DIGITS_0 = 0x01 , MAX7219_DECODE_CODEB_DIGITS_3_0 = 0x0F , MAX7219_DECODE_CODEB_DIGITS_7_0 = 0xFF }
 max7219 decode enumeration definition More...
 
enum  max7219_digital_t {
  MAX7219_DIGITAL_0 = 0x01 , MAX7219_DIGITAL_1 = 0x02 , MAX7219_DIGITAL_2 = 0x03 , MAX7219_DIGITAL_3 = 0x04 ,
  MAX7219_DIGITAL_4 = 0x05 , MAX7219_DIGITAL_5 = 0x06 , MAX7219_DIGITAL_6 = 0x07 , MAX7219_DIGITAL_7 = 0x08
}
 max7219 digital enumeration definition More...
 
enum  max7219_cascade_command_t {
  MAX7219_CASCADE_COMMAND_CASCADE = 0x00 , MAX7219_CASCADE_COMMAND_DIGIT_0 = 0x01 , MAX7219_CASCADE_COMMAND_DIGIT_1 = 0x02 , MAX7219_CASCADE_COMMAND_DIGIT_2 = 0x03 ,
  MAX7219_CASCADE_COMMAND_DIGIT_3 = 0x04 , MAX7219_CASCADE_COMMAND_DIGIT_4 = 0x05 , MAX7219_CASCADE_COMMAND_DIGIT_5 = 0x06 , MAX7219_CASCADE_COMMAND_DIGIT_6 = 0x07 ,
  MAX7219_CASCADE_COMMAND_DIGIT_7 = 0x08 , MAX7219_CASCADE_COMMAND_DECODE = 0x09 , MAX7219_CASCADE_COMMAND_INTENSITY = 0x0A , MAX7219_CASCADE_COMMAND_SCAN_LIMIT = 0x0B ,
  MAX7219_CASCADE_COMMAND_SHUT_DOWN = 0x0C , MAX7219_CASCADE_COMMAND_DISPLAY_TEST = 0x0F
}
 max7219 cascade command enumeration definition More...
 

Functions

uint8_t max7219_info (max7219_info_t *info)
 get chip's information More...
 
uint8_t max7219_init (max7219_handle_t *handle)
 initialize the chip More...
 
uint8_t max7219_deinit (max7219_handle_t *handle)
 close the chip More...
 
uint8_t max7219_set_display (max7219_handle_t *handle, max7219_digital_t digital, uint8_t data)
 set the display content More...
 
uint8_t max7219_set_matrix (max7219_handle_t *handle, uint8_t matrix[8])
 set the content matrix More...
 
uint8_t max7219_set_decode (max7219_handle_t *handle, max7219_decode_t decode)
 set the decode mode More...
 
uint8_t max7219_set_mode (max7219_handle_t *handle, max7219_mode_t mode)
 set the chip mode More...
 
uint8_t max7219_set_display_test_mode (max7219_handle_t *handle, max7219_display_test_mode_t mode)
 set the display test mode More...
 
uint8_t max7219_set_intensity (max7219_handle_t *handle, max7219_intensity_t intensity)
 set the display intensity More...
 
uint8_t max7219_set_scan_limit (max7219_handle_t *handle, max7219_scan_limit_t limit)
 set the scan limit More...
 
uint8_t max7219_set_cascade (max7219_handle_t *handle, max7219_cascade_t *cascade, uint16_t len)
 set the cascade data More...
 
uint8_t max7219_set_reg (max7219_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register More...
 

Detailed Description

driver max7219 header file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
2.0.0
Author
Shifeng Li
Date
2021-03-22

history

Date Version Author Description
2021/03/22 2.0 Shifeng Li format the code
2020/12/05 1.0 Shifeng Li first upload

Definition in file driver_max7219.h.