/* MAX7219 Header file * --------------------------- * For more information see * http://www.adnbr.co.uk/articles/max7219-and-7-segment-displays * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return. Shilov V.N. * ---------------------------------------------------------------------------- */ /* Define to prevent recursive inclusion -------------------------------------*/ #pragma once #ifndef __MAX7219_H #define __MAX7219_H /* Includes ------------------------------------------------------------------*/ #include "stm8l15x.h" /* Exported defines ----------------------------------------------------------*/ // соответсвие бит сегментам #define SEG_A 5 #define SEG_B 3 #define SEG_C 4 #define SEG_D 1 #define SEG_E 0 #define SEG_F 6 #define SEG_G 7 #define SEG_DP 2 // symbols // Для BCD #define MAX7219_CHAR_BLANK 0x0F #define MAX7219_CHAR_FULL 0x88 // без кодирования #define SYM_0 0x7B #define SYM_1 0x18 #define SYM_2 0xAB #define SYM_3 0xBA #define SYM_4 0xD8 #define SYM_5 0xF2 #define SYM_6 0xF3 #define SYM_7 0x38 #define SYM_8 0xFB #define SYM_9 0xFA #define SYM_A 0xF9 #define SYM_b 0xD3 #define SYM_c 0x83 #define SYM_C 0x63 #define SYM_d 0x9B #define SYM_E 0xE3 #define SYM_F 0xE1 #define SYM_P 0xE9 #define SYM_Gradus 0xE8 #define SYM_LGradus 0x93 #define SYM_Temp 0xC3 #define SYM_Minus 0x80 #define SYM_BLANK 0x00 #define SYM_FULL 0xFF #define MAX7219_ON 0x01 #define MAX7219_OFF 0x00 #define MAX7219_BRIGHT 0x08 // used LED digits - 1 #define MAX7219_DIGITS 7 /* Exported types ------------------------------------------------------------*/ typedef enum { Digit0 = 0x07, Digit1 = 0x06, Digit2 = 0x04, Digit3 = 0x01, Digit4 = 0x03, Digit5 = 0x02, Digit6 = 0x00, Digit7 = 0x05, DecodeMode = 0x09, Intensity = 0x0A, ScanLimit = 0x0B, Power = 0x0C, Test = 0x0F } max7219_reg_t; typedef enum { SegA = 5, SegB = 3, SegC = 4, SegD = 1, SegE = 0, SegF = 6, SegG = 7, SegDP = 2, } max7219_seg_t; typedef enum { Sym_0 = 0x7B, Sym_1 = 0x18, Sym_2 = 0xAB, Sym_3 = 0xBA, Sym_4 = 0xD8, Sym_5 = 0xF2, Sym_6 = 0xF3, Sym_7 = 0x38, Sym_8 = 0xFB, Sym_9 = 0xFA, Sym_A = 0xF9, Sym_b = 0xD3, Sym_c = 0x83, Sym_C = 0x63, Sym_d = 0x9B, Sym_E = 0xE3, Sym_F = 0xE1, Sym_P = 0xE9, Sym_Gradus = 0xE8, Sym_LGradus = 0x93, Sym_Temp = 0xC3, Sym_Minus = 0x80, Sym_Plus = 0x98, // C1 ? Sym_BLANK = 0x00, Sym_FULL = 0xFF } max7219_sym_t; /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported variables --------------------------------------------------------*/ /* Exported functions --------------------------------------------------------*/ void MAX7219_Init(void); void MAX7219_WriteData(max7219_reg_t reg, uint8_t data); #endif /* __MAX7219_H */