123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- /* 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 SYM_DOT 0x10
- // symbols Для BCD
- #define MAX7219_CHAR_BLANK 0x0F
- #define MAX7219_CHAR_FULL 0x88
- #define MAX7219_ON 0x01
- #define MAX7219_OFF 0x00
- #define MAX7219_BRIGHT 0x08
- // used LED digits - 1
- #define MAX7219_DIGITS 7
- /* Exported types ------------------------------------------------------------*/
- typedef enum _max7219_reg {
- RegNoOp = 0x00,
- RegDigit0 = 0x03,
- RegDigit1 = 0x08,
- RegDigit2 = 0x02,
- RegDigit3 = 0x01,
- RegDigit4 = 0x07,
- RegDigit5 = 0x04,
- RegDigit6 = 0x06,
- RegDigit7 = 0x05,
- RegDecodeMode = 0x09,
- RegIntensity = 0x0A,
- RegScanLimit = 0x0B,
- RegPower = 0x0C,
- RegTest = 0x0F
- } max7219_reg_t;
- // соответсвие бит сегментам
- typedef enum _max7219_seg {
- SegA = 1,
- SegB = 3,
- SegC = 2,
- SegD = 5,
- SegE = 6,
- SegF = 0,
- SegG = 7,
- SegDP = 4,
- } max7219_seg_t;
- // symbols без кодирования
- typedef enum _max7219_sym {
- Sym_0 = 0x6F,
- Sym_1 = 0x0C,
- Sym_2 = 0xEA,
- Sym_3 = 0xAE,
- Sym_4 = 0x8D,
- Sym_5 = 0xA7,
- Sym_6 = 0xE7,
- Sym_7 = 0x0E,
- Sym_8 = 0xEF,
- Sym_9 = 0xAF,
- Sym_A = 0xCF,
- Sym_b = 0xE5,
- Sym_c = 0xE0,
- Sym_C = 0x63,
- Sym_d = 0xEC,
- Sym_E = 0xE3,
- Sym_F = 0xC3,
- Sym_h = 0xC5,
- Sym_H = 0xCD,
- Sym_P = 0xCB,
- Sym_t = 0xE1,
- Sym_u = 0x64,
- Sym_U = 0x6D,
- Sym_Gradus = 0x8B,
- Sym_LGradus = 0xE4,
- Sym_Temp = 0xE1,
- Sym_Minus = 0x80,
- Sym_Plus = 0xD1,
- Sym_BLANK = 0x00,
- Sym_FULL = 0xFF,
- Sym_Dot = 0x10
- } max7219_sym_t;
- /* Exported constants --------------------------------------------------------*/
- /* Exported macro ------------------------------------------------------------*/
- /* Exported variables --------------------------------------------------------*/
- /* Exported functions --------------------------------------------------------*/
- void MAX7219_Config(void);
- void MAX7219_WriteData(max7219_reg_t reg, uint8_t data);
- #endif /* __MAX7219_H */
|