123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- /* MAX7219 Header file
- * ---------------------------
- * For more information see
- * http://www.adnbr.co.uk/articles/max7219-and-7-segment-displays
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <shilow@ukr.net> 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 1
- #define SEG_B 3
- #define SEG_C 2
- #define SEG_D 5
- #define SEG_E 6
- #define SEG_F 0
- #define SEG_G 7
- #define SEG_DP 4
- // symbols
- // Для BCD
- #define MAX7219_CHAR_BLANK 0x0F
- #define MAX7219_CHAR_FULL 0x88
- // без кодирования
- #define SYM_0 0x6F
- #define SYM_1 0x0C
- #define SYM_2 0xEA
- #define SYM_3 0xAE
- #define SYM_4 0x8D
- #define SYM_5 0xA7
- #define SYM_6 0xE7
- #define SYM_7 0x0E
- #define SYM_8 0xEF
- #define SYM_9 0xAF
- #define SYM_A 0xCF
- #define SYM_b 0xE5
- #define SYM_c 0xE0
- #define SYM_C 0x63
- #define SYM_d 0xEC
- #define SYM_E 0xE3
- #define SYM_F 0xC3
- #define SYM_P 0xCB
- #define SYM_Gradus 0x8B
- #define SYM_LGradus 0xE4
- #define SYM_Temp 0xE1
- #define SYM_Minus 0x80
- #define SYM_Plus 0xD1
- #define SYM_BLANK 0x00
- #define SYM_FULL 0xFF
- #define SYM_DOT 0x10
- #define MAX7219_ON 0x01
- #define MAX7219_OFF 0x00
- #define MAX7219_BRIGHT 0x08
- // used LED digits - 1
- #define MAX7219_DIGITS 7
- /* Exported types ------------------------------------------------------------*/
- typedef enum {
- NoOp = 0x00,
- Digit0 = 0x03,
- Digit1 = 0x08,
- Digit2 = 0x02,
- Digit3 = 0x01,
- Digit4 = 0x07,
- Digit5 = 0x04,
- Digit6 = 0x06,
- Digit7 = 0x05,
- DecodeMode = 0x09,
- Intensity = 0x0A,
- ScanLimit = 0x0B,
- Power = 0x0C,
- Test = 0x0F
- } max7219_reg_t;
- typedef enum {
- SegA = SEG_A,
- SegB = SEG_B,
- SegC = SEG_C,
- SegD = SEG_D,
- SegE = SEG_E,
- SegF = SEG_F,
- SegG = SEG_G,
- SegDP = SEG_DP,
- } max7219_seg_t;
- typedef enum {
- Sym_0 = SYM_0,
- Sym_1 = SYM_1,
- Sym_2 = SYM_2,
- Sym_3 = SYM_3,
- Sym_4 = SYM_4,
- Sym_5 = SYM_5,
- Sym_6 = SYM_6,
- Sym_7 = SYM_7,
- Sym_8 = SYM_8,
- Sym_9 = SYM_9,
- Sym_A = SYM_A,
- Sym_b = SYM_b,
- Sym_c = SYM_c,
- Sym_C = SYM_C,
- Sym_d = SYM_d,
- Sym_E = SYM_E,
- Sym_F = SYM_F,
- Sym_P = SYM_P,
- Sym_Gradus = SYM_Gradus,
- Sym_LGradus = SYM_LGradus,
- Sym_Temp = SYM_Temp,
- Sym_Minus = SYM_Minus,
- Sym_Plus = SYM_P,
- Sym_BLANK = SYM_BLANK,
- Sym_FULL = SYM_FULL,
- Sym_Dot = SYM_DOT
- } 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 */
|