Tab5 ST7121 variant + fixes (#605)

Added the newest variant to the tab5, St7121.
Fixed variant detection reliability
Fixed tab5 camera WHO_AM_I failing sometimes
Fixed tab5 keyboard live rotation on boot and after stopping/starting lvgl
This commit is contained in:
Shadowtrance
2026-08-02 04:50:55 +10:00
committed by GitHub
parent d72d5a0ef2
commit 85fe1a319a
31 changed files with 1531 additions and 222 deletions
@@ -3,6 +3,7 @@
#include "devices_common.h"
#include "devices_v1.h"
#include "devices_v2.h"
#include "devices_v3.h"
#include "tab5_keyboard.h"
#include <tactility/device.h>
@@ -91,16 +92,18 @@ static void on_display_detect_event(Device* device, DeviceEvent event, void* con
}
}
if (io_expander0 != nullptr && tab5_get_variant() == Tab5Variant::Unknown) {
Tab5Variant variant = tab5_probe_variant(i2c0);
tab5_set_variant(variant);
}
// We need i2c0 and io_expander0 to create the display and touch devices
// We need i2c0 and io_expander0 to pulse the LCD/touch reset pins, probe the variant, and
// create the display and touch devices - all gated on the same pair, so do them together in
// one pass. Order matters: the reset pulse must run *before* tab5_probe_variant(), otherwise
// the touch IC's response depends on whatever power-on state it happened to be in rather than
// a deterministic post-reset state.
if (!did_create_display && i2c0 != nullptr && io_expander0 != nullptr) {
did_create_display = true;
if (pulse_display_reset_pins(io_expander0)) {
switch (tab5_get_variant()) {
Tab5Variant variant = tab5_probe_variant(i2c0);
tab5_set_variant(variant);
switch (variant) {
case Tab5Variant::Unknown:
LOG_E(TAG, "Variant not detected yet");
break;
@@ -110,6 +113,9 @@ static void on_display_detect_event(Device* device, DeviceEvent event, void* con
case Tab5Variant::V2:
tab5_create_devices_v2(i2c0);
break;
case Tab5Variant::V3:
tab5_create_devices_v3(i2c0);
break;
}
} else {
LOG_E(TAG, "display_detect: skipping display creation, failed to pulse reset pins");