OLED_Driver.h
2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/******************************************************************************
***************************Intermediate driver layer***************************
* | file : OLED_Driver.h
* | version : V1.0
* | date : 2017-11-09
* | function : SSD1327 Drive function
note:
Image scanning:
Please use progressive scanning to generate images or fonts
******************************************************************************/
#ifndef __OLED_DRIVER_H
#define __OLED_DRIVER_H
#include <stdint.h>
#include "DEV_Config.h"
#define COLOR uint16_t //The variable type of the color (unsigned short)
#define POINT uint16_t //The type of coordinate (unsigned short)
#define LENGTH uint16_t //The type of coordinate (unsigned short)
/********************************************************************************
function:
Define the full screen height length of the display
********************************************************************************/
#define OLED_X_MAXPIXEL 128 //OLED width maximum memory
#define OLED_Y_MAXPIXEL 128 //OLED height maximum memory
#define OLED_X 0
#define OLED_Y 0
#define OLED_WIDTH (OLED_X_MAXPIXEL - 2 * OLED_X) //OLED width
#define OLED_HEIGHT OLED_Y_MAXPIXEL //OLED height
/********************************************************************************
function:
scanning method
********************************************************************************/
typedef enum{
L2R_U2D = 0, //The display interface is displayed , left to right, up to down
L2R_D2U ,
R2L_U2D ,
R2L_D2U ,
U2D_L2R ,
U2D_R2L ,
D2U_L2R ,
D2U_R2L ,
}OLED_SCAN_DIR;
#define SCAN_DIR_DFT L2R_U2D //Default scan direction = L2R_U2D
/********************************************************************************
function:
Defines the total number of rows in the display area
********************************************************************************/
typedef struct{
LENGTH OLED_Dis_Column; //COLUMN
LENGTH OLED_Dis_Page; //PAGE
OLED_SCAN_DIR OLED_Scan_Dir;
POINT OLED_X_Adjust; //OLED x actual display position calibration
POINT OLED_Y_Adjust; //OLED y actual display position calibration
}OLED_DIS;
/********************************************************************************
function:
Macro definition variable name
********************************************************************************/
void OLED_Init(OLED_SCAN_DIR OLED_ScanDir);
void OLED_SetGramScanWay(OLED_SCAN_DIR Scan_dir);
void OLED_WriteReg(uint8_t Reg);
void OLED_WriteData(uint8_t Data);
//OLED set cursor + windows + color
void OLED_SetCursor(POINT Xpoint, POINT Ypoint);
void OLED_SetColor(POINT Xpoint, POINT Ypoint, COLOR Color);
void OLED_SetWindow(POINT Xstart, POINT Ystart, POINT Xend, POINT Yend);
void OLED_Clear(COLOR Color);
void OLED_Display(void);
void OLED_ClearWindow(POINT Xstart, POINT Ystart, POINT Xend, POINT Yend, COLOR Color);
void OLED_DisWindow(POINT Xstart, POINT Ystart, POINT Xend, POINT Yend);
#endif