app: oled: use Zephyr SSD1306 driver and character framebuffer

Replace the oled-display-library module by the upstream Zephyr
solomon,ssd1306 display driver and the character framebuffer (CFB)
subsystem, so that the external module can be removed from the
manifest.

- A new uext_oled shield adds the display to the UEXT I2C bus, which
  gets a uext_i2c node label in all boards. The display is enabled
  with -DSHIELD=uext_oled instead of CONFIG_UEXT_OLED_DISPLAY=y.
- The display uses deferred init, so the application can power the
  UEXT port via the uext_en GPIO before initializing it.
- The classic Adafruit 5x7 font is ported to a CFB font to keep the
  screen layout unchanged. The Libre Solar logo is shown for 2 seconds
  after startup.
- CONFIG_UEXT_OLED_BRIGHTNESS is replaced by
  CONFIG_SSD1306_DEFAULT_CONTRAST.
- The heap is enlarged for the CFB frame buffer.
- oled.cpp is fixed for boards with PWM port or without load output
  and is only built if the display is enabled.
- A build-only twister scenario with the shield is added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Martin Jäger
2026-11-01 12:16:45 +01:00
co-authored by Claude Opus 5.5
parent 7f83930ebb
commit def84cc372
19 changed files with 457 additions and 138 deletions
-1
View File
@@ -7,7 +7,6 @@
"${workspaceFolder}/app/build/zephyr/include/generated",
"${workspaceFolder}/../modules/hal/cmsis/CMSIS/Core/Include",
"${workspaceFolder}/../modules/hal/stm32/stm32cube/stm32g0xx/soc",
"${workspaceFolder}/../modules/oled-display/src",
"${workspaceFolder}/../modules/thingset/src",
"${workspaceFolder}/../modules/unity/src",
"${workspaceFolder}/../zephyr/include",
+25 -8
View File
@@ -314,15 +314,32 @@ endmenu # Charge controller setup
menu "UEXT port"
config UEXT_OLED_DISPLAY
select I2C
bool "OLED display"
DT_CHOSEN_Z_DISPLAY := zephyr,display
config UEXT_OLED_BRIGHTNESS
depends on UEXT_OLED_DISPLAY
int "OLED display brightness"
range 1 255
default 1
config UEXT_OLED_DISPLAY
bool "OLED display"
depends on $(dt_chosen_enabled,$(DT_CHOSEN_Z_DISPLAY))
default y if SHIELD_UEXT_OLED
select DISPLAY
select CHARACTER_FRAMEBUFFER
help
Show live data on a SSD1306 128x64 OLED display connected to the UEXT
port. The display is configured via the uext_oled shield:
west build -b <board> app -- -DSHIELD=uext_oled
The brightness can be changed via CONFIG_SSD1306_DEFAULT_CONTRAST.
config HEAP_MEM_POOL_ADD_SIZE_UEXT_OLED
int
default 1280 if UEXT_OLED_DISPLAY
default 0
help
Frame buffer allocated by the character framebuffer subsystem (1024 bytes) plus some
margin for the heap management overhead.
config CHARACTER_FRAMEBUFFER_USE_DEFAULT_FONTS
default n if UEXT_OLED_DISPLAY
endmenu # UEXT port
+1 -2
View File
@@ -38,8 +38,7 @@ CONFIG_THINGSET_SDK_THREAD_PRIORITY=6
# Uncomment to disable regular data publication on ThingSet serial at startup
#CONFIG_THINGSET_REPORTING_LIVE_ENABLE_PRESET=n
# Uncomment to enable I2C OLED display in UEXT connector
#CONFIG_UEXT_OLED_DISPLAY=y
# I2C OLED display in UEXT connector is enabled by building with -DSHIELD=uext_oled
# Select initial battery configuration: GEL (default), FLOODED, AGM, LFP, NMC or NMC_HV
#CONFIG_BAT_TYPE_???=y
+10
View File
@@ -18,3 +18,13 @@ tests:
- pwm_2420_lus@0.2.0
- pwm_2420_lus@0.3.0
integration_platforms: *boards
charge_controller.firmware.uext_oled:
extra_args: SHIELD=uext_oled
# mppt_2420_lc and nucleo_g474re excluded: not enough RAM / no UEXT port
platform_allow: &uext_oled_boards
- mppt_1210_hus@0.7.0
- mppt_2420_hc@0.2.0
- mppt_2420_hpx
- mppt_2420_rc
- pwm_2420_lus@0.3.0
integration_platforms: *uext_oled_boards
+2 -1
View File
@@ -9,7 +9,6 @@ target_sources(app PRIVATE
device_status.cpp
dcdc.cpp
hardware.cpp
oled.cpp
leds.cpp
load.cpp
load_driver.c
@@ -20,6 +19,8 @@ target_sources(app PRIVATE
setup.cpp
)
target_sources_ifdef(CONFIG_UEXT_OLED_DISPLAY app PRIVATE oled.cpp oled_font.c)
if(${CONFIG_CUSTOM_DATA_OBJECTS_FILE})
target_sources(app PRIVATE data_objects_custom.cpp)
else()
+168 -114
View File
@@ -4,23 +4,25 @@
* SPDX-License-Identifier: Apache-2.0
*/
#if CONFIG_UEXT_OLED_DISPLAY
#include <math.h>
#include <stdio.h>
#include <zephyr/device.h>
#include <zephyr/display/cfb.h>
#include <zephyr/drivers/display.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
#include "oled_ssd1306.h"
#include <zephyr/logging/log.h>
#include <libresolar/drivers/half_bridge.h>
#include "oled_logo.h"
#include "setup.h"
LOG_MODULE_REGISTER(oled);
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), uext_en))
#define UEXT_EN_GPIO DT_CHILD(DT_PATH(outputs), uext_en)
#define UEXT_EN_NODE DT_CHILD(DT_PATH(outputs), uext_en)
#endif
const unsigned char bmp_load[] = {
@@ -40,12 +42,31 @@ const unsigned char bmp_disconnected[] = {
0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
OledSSD1306 oled(DEVICE_DT_GET(DT_ALIAS(i2c_uext)));
static const struct device *const display = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
static void draw_bitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h)
{
for (int16_t j = 0; j < h; j++) {
for (int16_t i = 0; i < w; i++) {
if (bitmap[i + (j / 8) * w] & BIT(j % 8)) {
struct cfb_position pos = { (int16_t)(x + i), (int16_t)(y + j) };
cfb_draw_point(display, &pos);
}
}
}
}
static void draw_rect(int16_t x, int16_t y, int16_t w, int16_t h)
{
struct cfb_position start = { x, y };
struct cfb_position end = { (int16_t)(x + w - 1), (int16_t)(y + h - 1) };
cfb_draw_rect(display, &start, &end);
}
void oled_update()
{
char buf[30];
unsigned int len;
#if CONFIG_HV_TERMINAL_SOLAR || CONFIG_PWM_TERMINAL_SOLAR
PowerPort &in_terminal = solar_terminal;
@@ -53,99 +74,6 @@ void oled_update()
PowerPort &in_terminal = grid_terminal;
#endif
oled.clear();
oled.drawBitmap(6, 0, bmp_pv_panel, 16, 16, 1);
oled.drawBitmap(104, 0, bmp_load, 16, 16, 1);
if (half_bridge_is_enabled(dcdc.half_bridge) == false) {
oled.drawBitmap(27, 3, bmp_disconnected, 32, 8, 1);
}
else {
oled.drawBitmap(34, 3, bmp_arrow_right, 5, 7, 1);
}
if (load.state == LOAD_STATE_ON) {
oled.drawBitmap(84, 3, bmp_arrow_right, 5, 7, 1);
}
else {
oled.drawBitmap(81, 3, bmp_disconnected, 17, 7, 1);
}
oled.drawRect(52, 2, 18, 9, 1); // battery shape
oled.drawRect(69, 3, 3, 7, 1); // battery terminal
if (charger.soc >= 20) {
oled.drawRect(54, 4, 2, 5, 1); // bar 1
}
if (charger.soc >= 40) {
oled.drawRect(57, 4, 2, 5, 1); // bar 2
}
if (charger.soc >= 60) {
oled.drawRect(60, 4, 2, 5, 1); // bar 3
}
if (charger.soc >= 80) {
oled.drawRect(63, 4, 2, 5, 1); // bar 4
}
if (charger.soc >= 95) {
oled.drawRect(66, 4, 2, 5, 1); // bar 5
}
// solar panel data
#if BOARD_HAS_PWM_PORT
if (pwm_switch.active()) {
#else
if (half_bridge_is_enabled(dcdc.half_bridge)) {
#endif
oled.setTextCursor(0, 18);
len = snprintf(buf, sizeof(buf), "%4.0fW",
(abs(in_terminal.power) < 1) ? 0
: -in_terminal.power); // remove negative zeros
oled.writeString(buf, len);
}
else {
oled.setTextCursor(8, 18);
len = snprintf(buf, sizeof(buf), "n/a");
oled.writeString(buf, len);
}
#if BOARD_HAS_PWM_PORT
if (in_terminal.bus->voltage > bat_terminal.bus->voltage)
#endif
{
oled.setTextCursor(0, 26);
len = snprintf(buf, sizeof(buf), "%4.1fV", in_terminal.bus->voltage);
oled.writeString(buf, len);
}
// battery data
oled.setTextCursor(42, 18);
len =
snprintf(buf, sizeof(buf), "%5.1fW",
(abs(bat_terminal.power) < 0.1) ? 0 : bat_terminal.power); // remove negative zeros
oled.writeString(buf, len);
oled.setTextCursor(42, 26);
len = snprintf(buf, sizeof(buf), "%5.1fV", bat_terminal.bus->voltage);
oled.writeString(buf, len);
// load data
oled.setTextCursor(90, 18);
len = snprintf(buf, sizeof(buf), "%5.1fW",
(abs(load.power) < 0.1) ? 0 : load.power); // remove negative zeros
oled.writeString(buf, len);
oled.setTextCursor(90, 26);
len = snprintf(buf, sizeof(buf), "%5.1fA\n", (abs(load.current) < 0.1) ? 0 : load.current);
oled.writeString(buf, len);
oled.setTextCursor(0, 36);
len = snprintf(buf, sizeof(buf), "Day +%5.0fWh -%5.0fWh", in_terminal.neg_energy_Wh,
fabs(load.pos_energy_Wh));
oled.writeString(buf, len);
len = snprintf(buf, sizeof(buf), "Tot +%4.1fkWh -%4.1fkWh", dev_stat.solar_in_total_Wh / 1000.0,
fabs(dev_stat.load_out_total_Wh) / 1000.0);
oled.writeString(buf, len);
oled.setTextCursor(0, 56);
#if BOARD_HAS_PWM_PORT
bool pwm_enabled = pwm_switch.active();
float duty_cycle = pwm_switch.get_duty_cycle();
@@ -154,31 +82,159 @@ void oled_update()
float duty_cycle = half_bridge_get_duty_cycle(dcdc.half_bridge);
#endif
cfb_framebuffer_clear(display, false);
draw_bitmap(6, 0, bmp_pv_panel, 16, 16);
if (pwm_enabled == false) {
draw_bitmap(27, 3, bmp_disconnected, 32, 8);
}
else {
draw_bitmap(34, 3, bmp_arrow_right, 5, 7);
}
#if BOARD_HAS_LOAD_OUTPUT
draw_bitmap(104, 0, bmp_load, 16, 16);
if (load.state == LOAD_STATE_ON) {
draw_bitmap(84, 3, bmp_arrow_right, 5, 7);
}
else {
draw_bitmap(81, 3, bmp_disconnected, 17, 7);
}
#endif
draw_rect(52, 2, 18, 9); // battery shape
draw_rect(69, 3, 3, 7); // battery terminal
if (charger.soc >= 20) {
draw_rect(54, 4, 2, 5); // bar 1
}
if (charger.soc >= 40) {
draw_rect(57, 4, 2, 5); // bar 2
}
if (charger.soc >= 60) {
draw_rect(60, 4, 2, 5); // bar 3
}
if (charger.soc >= 80) {
draw_rect(63, 4, 2, 5); // bar 4
}
if (charger.soc >= 95) {
draw_rect(66, 4, 2, 5); // bar 5
}
// solar panel data (values close to zero are printed as 0 to remove negative zeros)
if (pwm_enabled) {
snprintf(buf, sizeof(buf), "%4.0fW",
(fabsf(in_terminal.power) < 1.0F) ? 0.0 : -(double)in_terminal.power);
cfb_print(display, buf, 0, 18);
}
else {
cfb_print(display, "n/a", 8, 18);
}
#if BOARD_HAS_PWM_PORT
if (in_terminal.bus->voltage > bat_terminal.bus->voltage)
#endif
{
snprintf(buf, sizeof(buf), "%4.1fV", (double)in_terminal.bus->voltage);
cfb_print(display, buf, 0, 26);
}
// battery data
snprintf(buf, sizeof(buf), "%5.1fW",
(fabsf(bat_terminal.power) < 0.1F) ? 0.0 : (double)bat_terminal.power);
cfb_print(display, buf, 42, 18);
snprintf(buf, sizeof(buf), "%5.1fV", (double)bat_terminal.bus->voltage);
cfb_print(display, buf, 42, 26);
#if BOARD_HAS_LOAD_OUTPUT
float load_energy_Wh = load.pos_energy_Wh;
// load data
snprintf(buf, sizeof(buf), "%5.1fW", (fabsf(load.power) < 0.1F) ? 0.0 : (double)load.power);
cfb_print(display, buf, 90, 18);
snprintf(buf, sizeof(buf), "%5.1fA", (fabsf(load.current) < 0.1F) ? 0.0 : (double)load.current);
cfb_print(display, buf, 90, 26);
#else
float load_energy_Wh = 0.0F;
#endif
snprintf(buf, sizeof(buf), "Day +%5.0fWh -%5.0fWh", (double)in_terminal.neg_energy_Wh,
(double)fabsf(load_energy_Wh));
cfb_print(display, buf, 0, 36);
snprintf(buf, sizeof(buf), "Tot +%4.1fkWh -%4.1fkWh", dev_stat.solar_in_total_Wh / 1000.0,
fabs(dev_stat.load_out_total_Wh) / 1000.0);
cfb_print(display, buf, 0, 44);
float temp = charger.ext_temp_sensor ? charger.bat_temperature : dev_stat.internal_temp;
char tC = charger.ext_temp_sensor ? 'T' : 't';
if (pwm_enabled == true) {
len = snprintf(buf, sizeof(buf), "%c %.0fC PWM %.0f%% SOC %d%%", tC, temp,
duty_cycle * 100.0, charger.soc);
oled.writeString(buf, len);
snprintf(buf, sizeof(buf), "%c %.0fC PWM %.0f%% SOC %d%%", tC, (double)temp,
(double)duty_cycle * 100.0, charger.soc);
}
else {
len = snprintf(buf, sizeof(buf), "%c %.0fC PWM OFF SOC %d%%", tC, temp, charger.soc);
oled.writeString(buf, len);
snprintf(buf, sizeof(buf), "%c %.0fC PWM OFF SOC %d%%", tC, (double)temp, charger.soc);
}
cfb_print(display, buf, 0, 56);
cfb_framebuffer_finalize(display);
}
static int oled_init()
{
uint8_t font_width;
uint8_t font_height;
int err;
#ifdef UEXT_EN_NODE
const struct gpio_dt_spec uext_en = GPIO_DT_SPEC_GET(UEXT_EN_NODE, gpios);
err = gpio_pin_configure_dt(&uext_en, GPIO_OUTPUT_ACTIVE);
if (err != 0) {
return err;
}
oled.display();
/* the ready-time-ms of the display driver is counted from boot, not from power-on */
k_sleep(K_MSEC(DT_PROP(DT_CHOSEN(zephyr_display), ready_time_ms)));
#endif
/* deferred, as the UEXT port may not have been powered at boot */
err = device_init(display);
if (err != 0 && err != -EALREADY) {
return err;
}
err = cfb_framebuffer_init(display);
if (err != 0) {
return err;
}
/* select the 5x8 font from oled_font.c with 1 pixel spacing between characters */
for (int i = 0; i < cfb_get_numof_fonts(display); i++) {
cfb_get_font_size(display, i, &font_width, &font_height);
if (font_width == 5 && font_height == 8) {
cfb_framebuffer_set_font(display, i);
break;
}
}
cfb_set_kerning(display, 1);
draw_bitmap(0, 0, oled_logo, 128, 64);
cfb_framebuffer_finalize(display);
return display_blanking_off(display);
}
void oled_thread()
{
#if DT_NODE_EXISTS(DT_CHILD(DT_PATH(outputs), uext_en))
const struct device *dev_uext_en = device_get_binding(DT_GPIO_LABEL(UEXT_EN_GPIO, gpios));
gpio_pin_configure(dev_uext_en, DT_GPIO_PIN(UEXT_EN_GPIO, gpios),
DT_GPIO_FLAGS(UEXT_EN_GPIO, gpios) | GPIO_OUTPUT_ACTIVE);
#endif
int err = oled_init();
if (err != 0) {
LOG_ERR("Failed to initialize OLED display: %d", err);
return;
}
oled.init(CONFIG_UEXT_OLED_BRIGHTNESS);
/* keep the logo visible for a moment */
k_sleep(K_SECONDS(2));
while (true) {
oled_update();
@@ -187,5 +243,3 @@ void oled_thread()
}
K_THREAD_DEFINE(oled_thread_id, 1024, oled_thread, NULL, NULL, NULL, 6, 0, 1000);
#endif /* CONFIG_UEXT_OLED_DISPLAY */
+114
View File
@@ -0,0 +1,114 @@
/*
* Copyright (c) 2012 Adafruit Industries. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
/*
* Classic 5x7 fixed-space font of the Adafruit GFX library, reduced to printable ASCII
* characters and converted to a font for the Zephyr character framebuffer.
*
* Each glyph consists of 5 columns, the LSB of each byte is the topmost pixel.
*/
#include <zephyr/display/cfb.h>
static const uint8_t font_5x8_data[] = {
0x00, 0x00, 0x00, 0x00, 0x00, /* ' ' */
0x00, 0x00, 0x5f, 0x00, 0x00, /* '!' */
0x00, 0x07, 0x00, 0x07, 0x00, /* '"' */
0x14, 0x7f, 0x14, 0x7f, 0x14, /* '#' */
0x24, 0x2a, 0x7f, 0x2a, 0x12, /* '$' */
0x23, 0x13, 0x08, 0x64, 0x62, /* '%' */
0x36, 0x49, 0x56, 0x20, 0x50, /* '&' */
0x00, 0x08, 0x07, 0x03, 0x00, /* ''' */
0x00, 0x1c, 0x22, 0x41, 0x00, /* '(' */
0x00, 0x41, 0x22, 0x1c, 0x00, /* ')' */
0x2a, 0x1c, 0x7f, 0x1c, 0x2a, /* '*' */
0x08, 0x08, 0x3e, 0x08, 0x08, /* '+' */
0x00, 0x80, 0x70, 0x30, 0x00, /* ',' */
0x08, 0x08, 0x08, 0x08, 0x08, /* '-' */
0x00, 0x00, 0x60, 0x60, 0x00, /* '.' */
0x20, 0x10, 0x08, 0x04, 0x02, /* '/' */
0x3e, 0x51, 0x49, 0x45, 0x3e, /* '0' */
0x00, 0x42, 0x7f, 0x40, 0x00, /* '1' */
0x72, 0x49, 0x49, 0x49, 0x46, /* '2' */
0x21, 0x41, 0x49, 0x4d, 0x33, /* '3' */
0x18, 0x14, 0x12, 0x7f, 0x10, /* '4' */
0x27, 0x45, 0x45, 0x45, 0x39, /* '5' */
0x3c, 0x4a, 0x49, 0x49, 0x31, /* '6' */
0x41, 0x21, 0x11, 0x09, 0x07, /* '7' */
0x36, 0x49, 0x49, 0x49, 0x36, /* '8' */
0x46, 0x49, 0x49, 0x29, 0x1e, /* '9' */
0x00, 0x00, 0x14, 0x00, 0x00, /* ':' */
0x00, 0x40, 0x34, 0x00, 0x00, /* ';' */
0x00, 0x08, 0x14, 0x22, 0x41, /* '<' */
0x14, 0x14, 0x14, 0x14, 0x14, /* '=' */
0x00, 0x41, 0x22, 0x14, 0x08, /* '>' */
0x02, 0x01, 0x59, 0x09, 0x06, /* '?' */
0x3e, 0x41, 0x5d, 0x59, 0x4e, /* '@' */
0x7c, 0x12, 0x11, 0x12, 0x7c, /* 'A' */
0x7f, 0x49, 0x49, 0x49, 0x36, /* 'B' */
0x3e, 0x41, 0x41, 0x41, 0x22, /* 'C' */
0x7f, 0x41, 0x41, 0x41, 0x3e, /* 'D' */
0x7f, 0x49, 0x49, 0x49, 0x41, /* 'E' */
0x7f, 0x09, 0x09, 0x09, 0x01, /* 'F' */
0x3e, 0x41, 0x41, 0x51, 0x73, /* 'G' */
0x7f, 0x08, 0x08, 0x08, 0x7f, /* 'H' */
0x00, 0x41, 0x7f, 0x41, 0x00, /* 'I' */
0x20, 0x40, 0x41, 0x3f, 0x01, /* 'J' */
0x7f, 0x08, 0x14, 0x22, 0x41, /* 'K' */
0x7f, 0x40, 0x40, 0x40, 0x40, /* 'L' */
0x7f, 0x02, 0x1c, 0x02, 0x7f, /* 'M' */
0x7f, 0x04, 0x08, 0x10, 0x7f, /* 'N' */
0x3e, 0x41, 0x41, 0x41, 0x3e, /* 'O' */
0x7f, 0x09, 0x09, 0x09, 0x06, /* 'P' */
0x3e, 0x41, 0x51, 0x21, 0x5e, /* 'Q' */
0x7f, 0x09, 0x19, 0x29, 0x46, /* 'R' */
0x26, 0x49, 0x49, 0x49, 0x32, /* 'S' */
0x03, 0x01, 0x7f, 0x01, 0x03, /* 'T' */
0x3f, 0x40, 0x40, 0x40, 0x3f, /* 'U' */
0x1f, 0x20, 0x40, 0x20, 0x1f, /* 'V' */
0x3f, 0x40, 0x38, 0x40, 0x3f, /* 'W' */
0x63, 0x14, 0x08, 0x14, 0x63, /* 'X' */
0x03, 0x04, 0x78, 0x04, 0x03, /* 'Y' */
0x61, 0x59, 0x49, 0x4d, 0x43, /* 'Z' */
0x00, 0x7f, 0x41, 0x41, 0x41, /* '[' */
0x02, 0x04, 0x08, 0x10, 0x20, /* backslash */
0x00, 0x41, 0x41, 0x41, 0x7f, /* ']' */
0x04, 0x02, 0x01, 0x02, 0x04, /* '^' */
0x40, 0x40, 0x40, 0x40, 0x40, /* '_' */
0x00, 0x03, 0x07, 0x08, 0x00, /* '`' */
0x20, 0x54, 0x54, 0x78, 0x40, /* 'a' */
0x7f, 0x28, 0x44, 0x44, 0x38, /* 'b' */
0x38, 0x44, 0x44, 0x44, 0x28, /* 'c' */
0x38, 0x44, 0x44, 0x28, 0x7f, /* 'd' */
0x38, 0x54, 0x54, 0x54, 0x18, /* 'e' */
0x00, 0x08, 0x7e, 0x09, 0x02, /* 'f' */
0x18, 0xa4, 0xa4, 0x9c, 0x78, /* 'g' */
0x7f, 0x08, 0x04, 0x04, 0x78, /* 'h' */
0x00, 0x44, 0x7d, 0x40, 0x00, /* 'i' */
0x20, 0x40, 0x40, 0x3d, 0x00, /* 'j' */
0x7f, 0x10, 0x28, 0x44, 0x00, /* 'k' */
0x00, 0x41, 0x7f, 0x40, 0x00, /* 'l' */
0x7c, 0x04, 0x78, 0x04, 0x78, /* 'm' */
0x7c, 0x08, 0x04, 0x04, 0x78, /* 'n' */
0x38, 0x44, 0x44, 0x44, 0x38, /* 'o' */
0xfc, 0x18, 0x24, 0x24, 0x18, /* 'p' */
0x18, 0x24, 0x24, 0x18, 0xfc, /* 'q' */
0x7c, 0x08, 0x04, 0x04, 0x08, /* 'r' */
0x48, 0x54, 0x54, 0x54, 0x24, /* 's' */
0x04, 0x04, 0x3f, 0x44, 0x24, /* 't' */
0x3c, 0x40, 0x40, 0x20, 0x7c, /* 'u' */
0x1c, 0x20, 0x40, 0x20, 0x1c, /* 'v' */
0x3c, 0x40, 0x30, 0x40, 0x3c, /* 'w' */
0x44, 0x28, 0x10, 0x28, 0x44, /* 'x' */
0x4c, 0x90, 0x90, 0x90, 0x7c, /* 'y' */
0x44, 0x64, 0x54, 0x4c, 0x44, /* 'z' */
0x00, 0x08, 0x36, 0x41, 0x00, /* '{' */
0x00, 0x00, 0x77, 0x00, 0x00, /* '|' */
0x00, 0x41, 0x36, 0x08, 0x00, /* '}' */
0x02, 0x01, 0x02, 0x04, 0x02, /* '~' */
};
FONT_ENTRY_DEFINE(font_5x8, 5, 8, CFB_FONT_MONO_VPACKED, font_5x8_data, ' ', '~');
+80
View File
@@ -0,0 +1,80 @@
/*
* Copyright (c) The Libre Solar Project Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef OLED_LOGO_H_
#define OLED_LOGO_H_
#include <stdint.h>
/* Libre Solar logo in SSD1306 page layout (128x64 pixels, LSB of each byte at the top) */
static const uint8_t oled_logo[64 * 128 / 8] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0xC0, 0xE0, 0xE0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xE0, 0xC0, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0xE7, 0xC7,
0xC3, 0x87, 0x07, 0x07, 0x0F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1E, 0x1F, 0x1F, 0x3F,
0x3E, 0x7E, 0x7E, 0xFC, 0xFC, 0xF8, 0xF0, 0xC0, 0x01, 0x03, 0x87, 0x87, 0x87, 0x87, 0x87, 0x00,
0x30, 0x30, 0x30, 0x20, 0x20, 0x60, 0x40, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFC, 0xF8, 0xFC, 0xFC, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE,
0xFE, 0xFC, 0xF8, 0xF0, 0xE3, 0xC7, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x06, 0x18, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x03, 0x07, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x03, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x60, 0xC0,
0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xC0, 0x00, 0x00,
0x00, 0x00, 0x00, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x80, 0xC0,
0x60, 0x20, 0x20, 0x20, 0x20, 0x60, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0x40, 0x60, 0x20,
0x20, 0x60, 0x40, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xE0, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x60, 0x40, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x18, 0x77,
0xC0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x10, 0x10, 0x10, 0x10, 0x30, 0xD0, 0x08, 0x04, 0x03, 0x00,
0x00, 0x00, 0x00, 0xFF, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0F,
0x08, 0x18, 0x18, 0x10, 0x10, 0x30, 0xE0, 0x80, 0x00, 0x00, 0x10, 0xFF, 0x81, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xC7, 0xFF, 0x10, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF8, 0x8F, 0x81, 0x80, 0x87, 0x9C, 0xF0, 0x80, 0x00, 0x00,
0x00, 0x00, 0xFF, 0xFF, 0x10, 0x10, 0x10, 0x30, 0xF0, 0x88, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0C, 0x06,
0x03, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0E, 0x08, 0x00,
0x00, 0x00, 0x00, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x02, 0x06,
0x04, 0x04, 0x0C, 0x04, 0x04, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x06, 0x04, 0x0C,
0x0C, 0x04, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C,
0x0C, 0x0C, 0x00, 0x08, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x0C, 0x00,
0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0F, 0x0C, 0x00, 0x00, 0x00, 0x00
};
#endif /* OLED_LOGO_H_ */
@@ -174,7 +174,7 @@
bias-pull-up; // avoid junk characters if pin is left floating
};
&i2c1 {
uext_i2c: &i2c1 {
pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_FAST>;
@@ -178,7 +178,7 @@
bias-pull-up; // avoid junk characters if pin is left floating
};
&i2c1 {
uext_i2c: &i2c1 {
pinctrl-0 = <&i2c1_scl_pa15 &i2c1_sda_pb7>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_STANDARD>;
@@ -185,7 +185,7 @@
bias-pull-up; // avoid junk characters if pin is left floating
};
&i2c1 {
uext_i2c: &i2c1 {
pinctrl-0 = <&i2c1_scl_pa15 &i2c1_sda_pb7>;
pinctrl-names = "default";
status = "okay";
@@ -183,7 +183,7 @@
bias-pull-up; // avoid junk characters if pin is left floating
};
&i2c1 {
uext_i2c: &i2c1 {
status = "okay";
pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
pinctrl-names = "default";
@@ -213,7 +213,7 @@
status = "okay";
};
&i2c1 {
uext_i2c: &i2c1 {
/* shared between UEXT and EEPROM */
status = "okay";
pinctrl-0 = <&i2c1_scl_pa15 &i2c1_sda_pb7>;
@@ -187,7 +187,7 @@
bias-pull-up; // avoid junk characters if pin is left floating
};
&i2c1 {
uext_i2c: &i2c1 {
pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
pinctrl-names = "default";
status = "okay";
@@ -0,0 +1,9 @@
# Copyright (c) The Libre Solar Project Contributors
# SPDX-License-Identifier: Apache-2.0
if SHIELD_UEXT_OLED
config SSD1306_DEFAULT_CONTRAST
default 1
endif # SHIELD_UEXT_OLED
+5
View File
@@ -0,0 +1,5 @@
# Copyright (c) The Libre Solar Project Contributors
# SPDX-License-Identifier: Apache-2.0
config SHIELD_UEXT_OLED
def_bool $(shields_list_contains,uext_oled)
+6
View File
@@ -0,0 +1,6 @@
shield:
name: uext_oled
full_name: SSD1306 128x64 OLED display at UEXT connector
vendor: others
supported_features:
- display
@@ -0,0 +1,31 @@
/*
* Copyright (c) The Libre Solar Project Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
chosen {
zephyr,display = &uext_oled;
};
};
&uext_i2c {
status = "okay";
uext_oled: ssd1306@3c {
compatible = "solomon,ssd1306";
reg = <0x3c>;
width = <128>;
height = <64>;
segment-offset = <0>;
page-offset = <0>;
display-offset = <0>;
multiplex-ratio = <63>;
segment-remap;
com-invdir;
prechargep = <0xF1>;
/* initialized by the application after the UEXT port was powered */
zephyr,deferred-init;
};
};
-6
View File
@@ -2,8 +2,6 @@ manifest:
remotes:
- name: zephyrproject
url-base: https://github.com/zephyrproject-rtos
- name: libresolar
url-base: https://github.com/LibreSolar
- name: thingset
url-base: https://github.com/ThingSet
projects:
@@ -16,10 +14,6 @@ manifest:
- edtt
- hal_stm32
- zcbor
- name: oled-display-library
remote: libresolar
revision: 523b26c103de56714fcda655702d600870a671bc
path: modules/oled-display
- name: thingset-zephyr-sdk
remote: thingset
revision: 8b32f7db1898dc51daa1834b3f8058de6a67166f