Skip to content

Commit b1253f6

Browse files
committed
Add files for FB OLED support
This commit just adds the files to support the FB OLED device, 128x64px with each pixel being 1 nibble (4 bits), so FB is 64x64. Updated CMakeLists.txt to add option for OLED version Use -DUSE_OLED_VERSION=ON to build new OLED version (off by default)
1 parent c3d79cb commit b1253f6

File tree

3 files changed

+477
-3
lines changed

3 files changed

+477
-3
lines changed

CMakeLists.txt

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,14 @@ if (NOT DEFINED CPACK_PACKAGE_CONTACT)
6060
endif()
6161

6262
if (NOT DEFINED CPACK_PACKAGE_DESCRIPTION_SUMMARY)
63-
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
64-
"GENOA™ LCD display Interface library")
63+
# Conditionally set the description summary based on the selected version
64+
if (USE_OLED_VERSION)
65+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
66+
"SP7 LCD display Interface library")
67+
else()
68+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
69+
"GENOA™ LCD display Interface library")
70+
endif()
6571
endif()
6672

6773
set(CPACK_PACKAGE_FILE_NAME "lcdlib_lib32-${BUILD_VERSION_STRING}")
@@ -81,7 +87,24 @@ else ()
8187
endif ()
8288

8389
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
84-
set(LCDLIB_SRC_LIST ${LCDLIB_SRC_LIST} "${SRC_DIR}/lcdlib_common.c")
90+
# Conditionally include source and header files based on the selected version
91+
if (USE_OLED_VERSION)
92+
set(LCDLIB_SRC_LIST
93+
"${SRC_DIR}/lcdlib_common_oled.c"
94+
)
95+
set(LCD_INC_LIST
96+
"${INC_DIR}/lcdlib_common_oled.h"
97+
)
98+
message(STATUS "Building the OLED version of lcdlib")
99+
else()
100+
set(LCDLIB_SRC_LIST
101+
"${SRC_DIR}/lcdlib_common.c"
102+
)
103+
set(LCD_INC_LIST
104+
"${INC_DIR}/lcdlib_common.h"
105+
)
106+
message(STATUS "Building the legacy version of lcdlib")
107+
endif()
85108

86109

87110
#set(LCD_TOOL "lcdlib_tool")

include/lcdlib/lcdlib_common_oled.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#ifdef __cplusplus
2+
extern "C"
3+
{
4+
#endif
5+
#ifndef INCLUDE_LCDLIB_COMMON_OLED_H_
6+
#define INCLUDE_LCDLIB_COMMON_OLED_H_
7+
8+
/* Error Code */
9+
#define LCD_ERR_OPEN 0x80
10+
#define LCD_ERR_OPEN_I2C 0x81
11+
#define LCD_ERR_SET_CURSOR 0x82
12+
#define LCD_ERR_BAD_PARAM 0x83
13+
#define LCD_ERR_CLEAR_SCREEN 0x84
14+
#define LCD_ERR_WRITE 0x85
15+
#define LCD_ERR_IOCTL 0x86
16+
#define LCD_ERR_READ 0x87
17+
18+
#define LINE_HEIGHT_PX 9
19+
#define CHARACTER_WIDTH_PX 6
20+
#define CHARACTER_HEIGHT_PX 8
21+
22+
#define OLED_HEIGHT_PX 64
23+
#define OLED_WIDTH_PX 128
24+
#define OLED_HEIGHT_BYTES 64
25+
#define OLED_WIDTH_BYTES 64
26+
27+
/* LCD Message type */
28+
typedef enum
29+
{
30+
POST_CODE = 1,
31+
BMC_IPADDR,
32+
BMC_VER,
33+
BIOS_VER,
34+
HPM_FPGA
35+
} LCD_msgType_t;
36+
37+
int lcdlib_open_dev(void);
38+
int lcdlib_close_dev(void);
39+
int lcdlib_write_string(LCD_msgType_t msgType, unsigned char *buffer, int str_len);
40+
int lcdlib_clearScreen(void);
41+
42+
extern const unsigned char font6x8_ascii[128][6];
43+
44+
#endif // INCLUDE_LCDLIB_COMMON_OLED_H_
45+
#ifdef __cplusplus
46+
}
47+
#endif

0 commit comments

Comments
 (0)