Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ssd1315.h « ssd1315 « Components « BSP « Drivers - github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 42cd083e38f7a7e07a609eff70a9ad9eb8a78819 (plain)
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/**
  ******************************************************************************
  * @file    ssd1315.h
  * @author  MCD Application Team
  * @brief   This file contains all the functions prototypes for the ssd1315.c
  *          driver.
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; COPYRIGHT(c) 2020 STMicroelectronics</center></h2>
  *
  * This software component is licensed by ST under BSD 3-Clause license,
  * the "License"; You may not use this file except in compliance with the
  * License. You may obtain a copy of the License at:
  *                        opensource.org/licenses/BSD-3-Clause
  *
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef SSD1315_H
#define SSD1315_H

#ifdef __cplusplus
 extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "ssd1315_reg.h"
#include <stddef.h>

/** @addtogroup BSP
  * @{
  */

/** @addtogroup Components
  * @{
  */

/** @addtogroup SSD1315
  * @{
  */

/** @defgroup SSD1315_Exported_Types SSD1315 Exported Types
  * @{
  */
typedef int32_t (*SSD1315_Init_Func)     (void);
typedef int32_t (*SSD1315_DeInit_Func)   (void);
typedef int32_t (*SSD1315_GetTick_Func)  (void);
typedef int32_t (*SSD1315_Delay_Func)    (uint32_t);
typedef int32_t (*SSD1315_WriteReg_Func)(uint16_t, uint8_t*, uint16_t);
typedef int32_t (*SSD1315_ReadReg_Func) (uint16_t, uint8_t*, uint16_t);

typedef struct
{
  SSD1315_Init_Func             Init;
  SSD1315_DeInit_Func           DeInit;
  SSD1315_WriteReg_Func         WriteReg;
  SSD1315_ReadReg_Func          ReadReg;
  SSD1315_GetTick_Func          GetTick;
} SSD1315_IO_t;


typedef struct
{
  SSD1315_IO_t         IO;
  ssd1315_ctx_t        Ctx;
  uint8_t              IsInitialized;
  uint32_t             Orientation;
} SSD1315_Object_t;

typedef struct
{
  /* Control functions */
  int32_t (*Init             )(SSD1315_Object_t*, uint32_t, uint32_t);
  int32_t (*DeInit           )(SSD1315_Object_t*);
  int32_t (*ReadID           )(SSD1315_Object_t*, uint32_t*);
  int32_t (*DisplayOn        )(SSD1315_Object_t*);
  int32_t (*DisplayOff       )(SSD1315_Object_t*);
  int32_t (*SetBrightness    )(SSD1315_Object_t*, uint32_t);
  int32_t (*GetBrightness    )(SSD1315_Object_t*, uint32_t*);
  int32_t (*SetOrientation   )(SSD1315_Object_t*, uint32_t);
  int32_t (*GetOrientation   )(SSD1315_Object_t*, uint32_t*);
  int32_t (*Refresh          )(SSD1315_Object_t*);
  int32_t (*SetPage          )(SSD1315_Object_t*, uint16_t);
  int32_t (*SetColumn        )(SSD1315_Object_t*, uint16_t);
  int32_t (*ScrollingSetup   )(SSD1315_Object_t*, uint16_t, uint16_t, uint16_t, uint16_t);
  int32_t (*ScrollingStart   )(SSD1315_Object_t*);
  int32_t (*ScrollingStop    )(SSD1315_Object_t*);

  /* Drawing functions*/
  int32_t ( *SetCursor       ) (SSD1315_Object_t*, uint32_t, uint32_t);
  int32_t ( *DrawBitmap      ) (SSD1315_Object_t*, uint32_t, uint32_t, uint8_t *);
  int32_t ( *ShiftBitmap     ) (SSD1315_Object_t*,uint16_t, uint16_t, int16_t, int16_t, uint8_t*);
  int32_t ( *FillRGBRect     ) (SSD1315_Object_t*, uint32_t, uint32_t, uint8_t*, uint32_t, uint32_t);
  int32_t ( *DrawHLine       ) (SSD1315_Object_t*, uint32_t, uint32_t, uint32_t, uint32_t);
  int32_t ( *DrawVLine       ) (SSD1315_Object_t*, uint32_t, uint32_t, uint32_t, uint32_t);
  int32_t ( *FillRect        ) (SSD1315_Object_t*, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
  int32_t ( *GetPixel        ) (SSD1315_Object_t*, uint32_t, uint32_t, uint32_t*);
  int32_t ( *SetPixel        ) (SSD1315_Object_t*, uint32_t, uint32_t, uint32_t);
  int32_t ( *GetXSize        ) (SSD1315_Object_t*, uint32_t *);
  int32_t ( *GetYSize        ) (SSD1315_Object_t*, uint32_t *);
}SSD1315_Drv_t;

/**
  * @}
  */

/** @defgroup SSD1315_Exported_Constants  SSD1315 Exported Constants
  * @{
  */

/**
  * @brief  SSD1315 return code
  */
#define SSD1315_OK                (0)
#define SSD1315_ERROR             (-1)

/**
  * @brief  SSD1315 Size
  */
#define  SSD1315_LCD_PIXEL_WIDTH    ((uint16_t)128)
#define  SSD1315_LCD_PIXEL_HEIGHT   ((uint16_t)64)

#define  SSD1315_LCD_COLUMN_NUMBER  ((uint16_t)128)
#define  SSD1315_LCD_PAGE_NUMBER    ((uint16_t)8)

/**
  *  @brief LCD_Orientation
  *  Possible values of Display Orientation
  */
#define SSD1315_ORIENTATION_LANDSCAPE        0x00U /* Landscape orientation choice of LCD screen              */

/**
  *  @brief LCD_Format
  *  Possible values of Display format
  */
#define SSD1315_FORMAT_DEFAULT               0x00U

/**
  * @}
  */

/** @defgroup SSD1315_Exported_Functions SSD1315 Exported Functions
  * @{
  */
int32_t SSD1315_RegisterBusIO(SSD1315_Object_t *pObj, SSD1315_IO_t *pIO);
int32_t SSD1315_Init(SSD1315_Object_t *pObj, uint32_t ColorCoding, uint32_t Orientation);
int32_t SSD1315_DeInit(SSD1315_Object_t *pObj);
int32_t SSD1315_ReadID(SSD1315_Object_t *pObj, uint32_t *Id);
int32_t SSD1315_DisplayOn(SSD1315_Object_t *pObj);
int32_t SSD1315_DisplayOff(SSD1315_Object_t *pObj);
int32_t SSD1315_SetBrightness(SSD1315_Object_t *pObj, uint32_t Brightness);
int32_t SSD1315_GetBrightness(SSD1315_Object_t *pObj, uint32_t *Brightness);
int32_t SSD1315_SetOrientation(SSD1315_Object_t *pObj, uint32_t Orientation);
int32_t SSD1315_GetOrientation(SSD1315_Object_t *pObj, uint32_t *Orientation);
int32_t SSD1315_Refresh(SSD1315_Object_t *pObj);

int32_t SSD1315_SetPage(SSD1315_Object_t *pObj, uint16_t Page);
int32_t SSD1315_SetColumn(SSD1315_Object_t *pObj, uint16_t Column);
int32_t SSD1315_ScrollingSetup(SSD1315_Object_t *pObj, uint16_t ScrollMode, uint16_t StartPage, uint16_t EndPage, uint16_t Frequency);
int32_t SSD1315_ScrollingStart(SSD1315_Object_t *pObj);
int32_t SSD1315_ScrollingStop(SSD1315_Object_t *pObj);

int32_t SSD1315_SetCursor(SSD1315_Object_t *pObj, uint32_t Xpos, uint32_t Ypos);
int32_t SSD1315_DrawBitmap(SSD1315_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint8_t *pBmp);
int32_t SSD1315_ShiftBitmap(SSD1315_Object_t *pObj,uint16_t Xpos, uint16_t Ypos, int16_t Xshift, int16_t Yshift, uint8_t *pbmp);
int32_t SSD1315_FillRGBRect(SSD1315_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint8_t *pData, uint32_t Width, uint32_t Height);
int32_t SSD1315_DrawHLine(SSD1315_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t Length, uint32_t Color);
int32_t SSD1315_DrawVLine(SSD1315_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t Length, uint32_t Color);
int32_t SSD1315_DrawLine(SSD1315_Object_t *pObj, uint32_t X1pos, uint32_t Y1pos, uint32_t X2pos, uint32_t Y2pos, uint32_t Color);
int32_t SSD1315_FillRect(SSD1315_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t Width, uint32_t Height, uint32_t Color);
int32_t SSD1315_SetPixel(SSD1315_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t Color);
int32_t SSD1315_GetPixel(SSD1315_Object_t *pObj, uint32_t Xpos, uint32_t Ypos, uint32_t *Color);
int32_t SSD1315_GetXSize(SSD1315_Object_t *pObj, uint32_t *XSize);
int32_t SSD1315_GetYSize(SSD1315_Object_t *pObj, uint32_t *YSize);

/**
  * @}
  */

/** @addtogroup SSD1315_Exported_Variables SSD1315 Exported Variables
 * @{
 */
/* LCD driver structure */
extern SSD1315_Drv_t   SSD1315_Driver;
/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */

#ifdef __cplusplus
}
#endif

#endif /* SSD1315_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/