# third_party_u8g2 **Repository Path**: talkweb_oh/third_party_u8g2 ## Basic Information - **Project Name**: third_party_u8g2 - **Description**: 适配OH轻量设备的OLED库 - **Primary Language**: C - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-09-29 - **Last Updated**: 2025-02-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/olikraus/u8g2) ![https://raw.githubusercontent.com/wiki/olikraus/u8g2/ref/u8g2_logo_transparent_orange.png](https://raw.githubusercontent.com/wiki/olikraus/u8g2/ref/u8g2_logo_transparent_orange.png) U8g2: Library for monochrome displays, version 2 U8g2 is a monochrome graphics library for embedded devices. U8g2 supports monochrome OLEDs and LCDs, which include the following controllers: SSD1305, SSD1306, SSD1309, SSD1322, SSD1325, SSD1327, SSD1329, SSD1606, SSD1607, SH1106, SH1107, SH1108, SH1122, T6963, RA8835, LC7981, PCD8544, PCF8812, HX1230, UC1601, UC1604, UC1608, UC1610, UC1611, UC1701, ST7565, ST7567, ST7588, ST75256, NT7534, IST3020, ST7920, LD7032, KS0108, SED1520, SBN1661, IL3820, MAX7219 (see [here](https://github.com/olikraus/u8g2/wiki/u8g2setupcpp) for a full list). The Arduino library U8g2 can be installed from the library manager of the Arduino IDE. U8g2 also includes U8x8 library: * U8g2 * Includes all graphics procedures (line/box/circle draw). * Supports many fonts. (Almost) no restriction on the font height. * Requires some memory in the microcontroller to render the display. * U8x8 * Text output only (character) device. * Only fonts allowed with fit into a 8x8 pixel grid. * Writes directly to the display. No buffer in the microcontroller required. [Setup Guide and Reference Manual](https://github.com/olikraus/u8g2/wiki) ## OpenHarmony使用帮助 参考 example 下的示例工程 目前使用I2C进行驱动,如果要调整请修改 hals/src/u8g2OH.c 文件 ```c // for Talkweb Niobe 开发板 void Hal_I2cInit() { IoTGpioInit(WIFI_IOT_IO_NAME_GPIO_13); IoTGpioInit(WIFI_IOT_IO_NAME_GPIO_14); IotIoSetFunc(WIFI_IOT_IO_NAME_GPIO_13, IoT_IO_FUNC_GPIO_13_I2C0_SDA); IotIoSetFunc(WIFI_IOT_IO_NAME_GPIO_14, IoT_IO_FUNC_GPIO_14_I2C0_SCL); IoTI2cInit(WIFI_IOT_I2C_IDX_0, OLED_I2C_BAUDRATE); } ``` ### Talkweb Niobe ![](./figures/niobe.jpg) ### 润和 wifiiot_hispark_pegasus ![](./figures/wifiiot_hispark_pegasus.jpg) ### 使用方式 复制 example 下的 u8g2MyDemo 目录,到 applications\app 目录下, 调整 BUILD.gn ```gn import("//build/lite/config/component/lite_component.gni") lite_component("app") { features = [ "u8g2MyDemo:u8g2_example" ] } ``` 编译 ~ ### note * 默认只支持SSD1306 OLED,如果有其他屏幕的需求,可以去改 third_party\u8g2\BUILD.gn * 默认附带海思3861的管脚复用定义 * 默认支持OpenHarmony2.0 以及 OpenHarmony2.2