123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- /* 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 "stm8s.h"
- /* Exported defines ----------------------------------------------------------*/
- #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 = 0x01,
- RegDigit1 = 0x07,
- RegDigit2 = 0x03,
- RegDigit3 = 0x06,
- RegDigit4 = 0x05,
- RegDigit5 = 0x04,
- RegDigit6 = 0x08,
- RegDigit7 = 0x02,
- RegDecodeMode = 0x09,
- RegIntensity = 0x0A,
- RegScanLimit = 0x0B,
- RegPower = 0x0C,
- RegTest = 0x0F
- } max7219_reg_t;
- // соответсвие бит сегментам
- typedef enum _max7219_seg {
- SegA = 4,
- SegB = 0,
- SegC = 1,
- SegD = 7,
- SegE = 3,
- SegF = 2,
- SegG = 5,
- SegDP = 6,
- } max7219_seg_t;
- // symbols без кодирования
- typedef enum _max7219_sym {
- Sym_0 = 0x9F,
- Sym_1 = 0x03,
- Sym_2 = 0xB9,
- Sym_3 = 0xB3,
- Sym_4 = 0x27,
- Sym_5 = 0xB6,
- Sym_6 = 0xBe,
- Sym_7 = 0x13,
- Sym_8 = 0xBF,
- Sym_9 = 0xB7,
- Sym_A = 0x3F,
- Sym_b = 0xAE,
- Sym_c = 0xA8,
- Sym_C = 0x9C,
- Sym_d = 0xAB,
- Sym_E = 0xBC,
- Sym_F = 0x3C,
- Sym_h = 0x2E,
- Sym_H = 0x2F,
- Sym_o = 0xAA,
- Sym_P = 0x3D,
- Sym_t = 0xAC,
- Sym_u = 0x8A,
- Sym_U = 0x8F,
- Sym_Gradus = 0x35,
- Sym_Minus = 0x20,
- Sym_BLANK = 0x00,
- Sym_FULL = 0xFF,
- Sym_Dot = 0x40
- } 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 */
|