-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathssd1315_reg.h
143 lines (123 loc) · 4.02 KB
/
ssd1315_reg.h
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/**
******************************************************************************
* @file ssd1315_reg.h
* @author MCD Application Team
* @brief This file contains all the functions prototypes for the
* ssd1315_reg.c driver.
******************************************************************************
* @attention
*
* Copyright (c) 2020 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef SSD1315_REG_H
#define SSD1315_REG_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup SSD1315
* @{
*/
/** @defgroup SSD1315_REG_Exported_Constants SSD1315 REG Exported Constants
* @{
*/
/**
* @brief SSD1315 Colors
*/
#define SSD1315_COLOR_WHITE 0xFF
#define SSD1315_COLOR_BLACK 0x00
/**
* @brief SSD1315 Scrolling
*/
#define SSD1315_SCROLL_RIGHT 0x26
#define SSD1315_SCROLL_LEFT 0x27
#define SSD1315_ACTIVATE_SCROLL 0x2F
#define SSD1315_DESACTIVATE_SCROLL 0x2E
#define SSD1315_SCROLL_FREQ_2FRAMES 0x07
#define SSD1315_SCROLL_FREQ_3FRAMES 0x04
#define SSD1315_SCROLL_FREQ_4FRAMES 0x05
#define SSD1315_SCROLL_FREQ_5FRAMES 0x06
#define SSD1315_SCROLL_FREQ_6FRAMES 0x00
#define SSD1315_SCROLL_FREQ_32FRAMES 0x01
#define SSD1315_SCROLL_FREQ_64FRAMES 0x02
#define SSD1315_SCROLL_FREQ_128FRAMES 0x03
/**
* @brief SSD1315 Commands
*/
#define SSD1315_CHARGE_PUMP_SETTING 0x8D
#define SSD1315_READWRITE_CMD 0x80
#define SSD1315_HIGHER_COLUMN_START_ADRESS_1 0x10
#define SSD1315_HIGHER_COLUMN_START_ADRESS_2 0x11
#define SSD1315_HIGHER_COLUMN_START_ADRESS_3 0x12
#define SSD1315_HIGHER_COLUMN_START_ADRESS_4 0x13
#define SSD1315_HIGHER_COLUMN_START_ADRESS_5 0x14
#define SSD1315_HIGHER_COLUMN_START_ADRESS_6 0x15
#define SSD1315_HIGHER_COLUMN_START_ADRESS_7 0x16
#define SSD1315_HIGHER_COLUMN_START_ADRESS_8 0x17
#define SSD1315_LOWER_COLUMN_START_ADRESS 0x00
#define SSD1315_LOWER_COLUMN_START_ADRESS_15 0x0F
#define SSD1315_MEMORY_ADRESS_MODE 0x20
#define SSD1315_SET_COLUMN_ADRESS 0x21
#define SSD1315_SET_PAGE_ADRESS 0x22
#define SSD1315_DISPLAY_START_LINE_1 0x40
#define SSD1315_DISPLAY_START_LINE_32 0x1F
#define SSD1315_DISPLAY_START_LINE_64 0x7F
#define SSD1315_REMAPPED_MODE 0xC8
#define SSD1315_CONTRAST_CONTROL 0xA1
#define SSD1315_CONTRAST_CONTROL_2 0xFF
#define SSD1315_DISPLAY_ON 0xAF
#define SSD1315_DISPLAY_OFF 0xAE
#define SSD1315_SET_PAGE_START_ADRESS 0xB0
/**
* @}
*/
/** @defgroup SSD1315_REG_Exported_Types SSD1315 REG Exported Types
* @{
*/
typedef int32_t (*SSD1315_Write_Func) (void *, uint16_t, uint8_t*, uint16_t); /* this will connect to the LCD_IO_WriteData */
typedef int32_t (*SSD1315_Read_Func) (void *, uint16_t, uint8_t*, uint16_t); /* this will connect to the LCD_IO_ReadData */
typedef struct
{
SSD1315_Write_Func WriteReg;
SSD1315_Read_Func ReadReg;
void *handle;
} ssd1315_ctx_t;
/**
* @}
*/
/** @defgroup SSD1315_REG_Exported_Functions SSD1315 REG Exported Functions
* @{
*/
int32_t ssd1315_write_reg(ssd1315_ctx_t *ctx, uint16_t reg, uint8_t *pdata, uint16_t length);
int32_t ssd1315_read_reg(ssd1315_ctx_t *ctx, uint16_t reg, uint8_t *pdata, uint16_t length);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* SSD1315_REG_H */