Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2630043
Enhance font storage and display functionality
wangli65535-coder Feb 7, 2026
be8f178
Add support for dual font storage partitions and enhance font display…
wangli65535-coder Feb 10, 2026
32f0de8
Refactor font storage and display configurations
wangli65535-coder Feb 11, 2026
467bcf6
Update font handling and display configurations for GBK support
wangli65535-coder Feb 27, 2026
b87c75b
merge: sync Cole_gbk_test with dev-nexfirmware-evt1
wangli65535-coder Feb 28, 2026
732f4d8
Add hinge fold detection component
wangli65535-coder Mar 2, 2026
ef5e1d7
Refactor audio handling to integrate GX8002 VAD
wangli65535-coder Mar 4, 2026
e2db4fe
Merge branch 'dev-nexfirmware-evt1' into Cole_gbk_test
nic-olo Mar 17, 2026
41879a4
git ignore
nic-olo Mar 17, 2026
fe71f2f
Merge branch 'Cole_gbk_test' of github.com:Mentra-Community/MentraOS …
nic-olo Mar 17, 2026
d89320b
Refactor lvgl_display.c: Improve code readability and maintainability
wangli65535-coder Mar 17, 2026
8a237ce
Optimize LVGL text rendering and clean up debug code
wangli65535-coder Mar 19, 2026
417c092
Merge branch 'dev-nexfirmware-evt1' into Cole_gbk_test
nic-olo Mar 20, 2026
550c276
Add generated font binaries for flashing.
wangli65535-coder Mar 23, 2026
97ddb5f
Document Red Hat Display source for EN font assets.
wangli65535-coder Mar 23, 2026
04abad4
Implement dynamic binfont switching and English-only display fallback.
wangli65535-coder Mar 23, 2026
8f691e0
feat(display): Enhance display control with depth and stereo adjustments
wangli65535-coder Mar 25, 2026
7205007
feat(display): unify protobuf throttling and GX8002 upgrade switches
wangli65535-coder Mar 26, 2026
72b7919
refactor(audio): transition to PDM microphone and disable GX8002 VAD
wangli65535-coder Mar 27, 2026
4478a2b
fix(audio): set PDM channel count to mono for LC3 encode
wangli65535-coder Mar 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ K900_android_sdk/*
K900Server_open/*
k900_android_sdk/*
K900ServerPlus/*
K900Server_mentra/*
K900_server/*
.claude/*
aar_extract/*
Expand Down Expand Up @@ -120,16 +121,12 @@ dist
docs/_build/
eggs
htmlcov
<<<<<<< dev-nexfirmware-evt1
# Python include/lib directories (not MCU includes)
**/python/**/include/
**/python/**/lib/
**/venv/**/include/
**/venv/**/lib/
=======
#include/
.lib/
>>>>>>> dev
man/
nosetests.xml
parts
Expand Down Expand Up @@ -195,13 +192,10 @@ dist/
downloads/
eggs/
.eggs/
<<<<<<< dev-nexfirmware-evt1
# Python lib directories (specific to Python builds)
**/python/**/lib/
**/python/**/lib64/
=======
.lib/
>>>>>>> dev
lib64/
parts/
sdist/
Expand Down
5 changes: 5 additions & 0 deletions mcu_client/nrf5340_ble_simulator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ add_subdirectory(src/mos_components/mos_sysport)
add_subdirectory(src/mos_components/mos_pdm)
add_subdirectory(src/mos_components/mos_battery)
add_subdirectory(src/mos_components/mos_button)
add_subdirectory(src/mos_components/mos_hinge_fold)
add_subdirectory(src/mos_components/mos_interrupt)
# add_subdirectory(src/mos_components/mos_gx8002) # VAD/GX8002 off; PDM mic path
add_subdirectory(src/mos_components/mos_font_storage)
add_subdirectory(src/mos_components/mos_lvgl_display)
add_subdirectory(src/mos_components/mos_jlink_usb_switch)
add_subdirectory(src/mos_components/mos_dfu_progress)
Expand All @@ -32,10 +35,12 @@ target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)

target_sources(app PRIVATE
src/main.c
src/shell_font_storage.c
src/shell_display_control.c
src/shell_opt3006.c
src/shell_battery_control.c
src/shell_audio_control.c
# src/shell_gx8002_control.c # GX8002/VAD shell off with PDM mic
src/shell_lsm6dsv16x.c
src/shell_jlink_usb_switch.c
src/shell_npm1300_led.c
Expand Down
99 changes: 99 additions & 0 deletions mcu_client/nrf5340_ble_simulator/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,105 @@ config USER_STEREO_2RX_L
config USER_STEREO_2RX_LR
bool "encode fifo enable"
default n

config FONT_STORAGE_LOAD_AT_RUNTIME
bool "Load Chinese font (中文字库) from external flash (font_storage) at runtime"
default n
depends on LVGL && FLASH_MAP
help
When enabled, display_get_font(\"gbk\") loads a LVGL binfont from the
font_storage partition on first use.

config FONT_STORAGE_FILE_SIZE
int "Font storage file size (bytes, 0 = partition size)"
default 0
depends on LVGL && FLASH_MAP
help
Size of the .bin font in font_storage. If 0, use partition size.

config FONT_STORAGE_USE_XIP
bool "Use XIP address for font buffer (no RAM copy)"
default n
depends on LVGL && FLASH_MAP
help
Use external flash XIP address (0x10000000 + PM_FONT_STORAGE_ADDRESS)
as the binfont buffer to avoid RAM copy.

config FONT_STORAGE_USE_PARTITION_2
bool "Use font_storage2 partition for font data"
default n
depends on LVGL && FLASH_MAP
help
When enabled, load font data from the font_storage2 partition instead
of font_storage. This is useful when you split fonts across partitions.

config BINFONT_GLYPH_ORDER_WHXY
bool "Use glyf order (adv,W,H,X,Y) instead of spec (adv,X,Y,W,H)"
default n
depends on LVGL && FLASH_MAP
help
LVGL font_spec: advanceWidth, BBox X, Y, Width, Height. Some tools
output (adv, Width, Height, X, Y). Enable this if you get bitmap
overflow with an uncompressed binfont.

config BINFONT_A1_INVERT
bool "Invert 1bpp (A1) glyph bits for correct contrast"
default n
depends on LVGL && FLASH_MAP
help
When enabled, invert each byte of the A1 bitmap. Try this if 1bpp
text appears faint or blurry (font may use 0=ink vs LVGL 1=ink).
Disable if text becomes inverted or wrong.

config BINFONT_SYNC_LINE_METRICS_MONTSERRAT18
bool "Force binfont line_height/base_line to match Montserrat 18 (symbol mix only)"
default n
depends on LVGL
help
When enabled and font_size==18, overrides binfont metrics with Montserrat 18.
Leave disabled for pure Flash text: wrong line box vs glyph ofs_y causes overlap/garbled text.

config BINFONT_GLYPH_DEBUG
bool "Verbose binfont glyph / bitmap logging (slow, floods console)"
default n
depends on LVGL

choice MOS_WELCOME_BINFONT_LANG
prompt "Boot default: external flash binfont (before any runtime switch)"
default MOS_WELCOME_LANG_EN
depends on LVGL
help
Initial s_current_language / partition used on first mos_binfont_lvgl_init()
or mos_binfont_get_lvgl_font() lazy load. Runtime mos_font_switch_language()
changes the active font for welcome, BLE text, and display_get_font(); this
choice is not re-applied on each welcome refresh.

config MOS_WELCOME_LANG_EN
bool "English (font_storage_en_<size>)"

config MOS_WELCOME_LANG_ZH_CN
bool "Simplified Chinese 18pt (font_storage_zh_cn_18)"
endchoice

config MOS_WELCOME_BINFONT_PT_SIZE
int "Boot default English binfont point size"
default 18
range 16 26
depends on LVGL && MOS_WELCOME_LANG_EN
help
Used only when MOS_WELCOME_LANG_EN. Must be an even value in 16..26 and match
a flashed font_storage_en_* partition. Invalid values fall back to 18 on first init.

config MOS_DISPLAY_TEXT_PAYLOAD_DIAG
bool "DisplayText payload diagnostic log (escaped \\n for support / audits)"
default n
depends on LVGL
help
Logs [TEXT_PAYLOAD] for each BLE DisplayText update: UTF-8 byte length,
LF/CR counts, first LF/CR byte offsets, and an escaped preview where
line breaks appear as \\n. Use to show customers that hard breaks came
from the phone payload; soft wrap-only lines have LF=0 in the string.

endmenu

# Include custom driver module Kconfig (projector display)
Expand Down
55 changes: 40 additions & 15 deletions mcu_client/nrf5340_ble_simulator/app.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
};

zephyr_user: zephyr,user {
imu_int1-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>; // P1.15 for LSM6DSV16X INT1
jlink_usb_switch-gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; // P1.11 for J-Link/USB switch control
button-gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>; // P0.23 for button input
vad_power-gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>; // P1.00 for VAD_EN power control

int4-gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>; // P0.22 INT4
// GX8002 / VAD path disabled - microphone uses PDM (see &pdm0)
vad_power-gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;
gx8002_vad_int-gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
vad_voice_detect-gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
ear_en-gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>; // P0.19 for Ear Power Enable
};
};
Expand Down Expand Up @@ -50,6 +51,21 @@
};
};

i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 1, 4)>,
<NRF_PSEL(TWIM_SCL, 1, 5)>;
nordic,drive-mode = <NRF_DRIVE_S0D1>;
};
};
i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 1, 4)>,
<NRF_PSEL(TWIM_SCL, 1, 5)>;
low-power-enable;
};
};

i2c2_default: i2c2_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 31)>,
Expand All @@ -61,8 +77,8 @@
i2c2_sleep: i2c2_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 31)>,
<NRF_PSEL(TWIM_SCL, 0, 30)>;
low-power-enable;
<NRF_PSEL(TWIM_SCL, 0, 30)>;
low-power-enable;
};
};
i2c3_default: i2c3_default {
Expand All @@ -81,13 +97,13 @@
};
};

// GX8002 VAD I2S slave pins disabled (was SDIN/SCK_S/LRCK_S on P1.09/P1.08/P1.06).
// I2S master below is for optional shell LC3->I2S loopback (mos_i2s_master).
i2s0_default: i2s0_default {
group1 {
psels = <NRF_PSEL(I2S_SDOUT, 1, 6)>,
<NRF_PSEL(I2S_SCK_M, 1, 7)>,
<NRF_PSEL(I2S_LRCK_M, 1, 8)>;
// <NRF_PSEL(I2S_SDIN, 0, 0)>;

psels = <NRF_PSEL(I2S_SDOUT, 1, 9)>,
<NRF_PSEL(I2S_SCK_M, 1, 8)>,
<NRF_PSEL(I2S_LRCK_M, 1, 6)>;
};
};
};
Expand All @@ -96,6 +112,15 @@
status = "disabled";
};

// I2C0 for GX8002 VAD chip (P1.04 SDA, P1.05 SCL) - disabled
// &i2c0 {
// compatible = "nordic,nrf-twim";
// status = "okay";
// pinctrl-0 = <&i2c0_default>;
// pinctrl-1 = <&i2c0_sleep>;
// pinctrl-names = "default", "sleep";
// };

/* Enable SPI4 with 32MHz capability for A6N */
&spi4 {
compatible = "nordic,nrf-spim";
Expand Down Expand Up @@ -124,7 +149,7 @@



/* Enable PDM for microphone audio streaming */
/* PDM microphone: CLK P0.20, DIN P0.21 */
&pdm0 {
status = "okay";
pinctrl-0 = <&pdm0_default>;
Expand All @@ -139,7 +164,7 @@
pinctrl-0 = <&i2c2_default>;
pinctrl-1 = <&i2c2_sleep>;
pinctrl-names = "default", "sleep";

lsm6dsv16x: lsm6dsv16x@6a {
compatible = "st,lsm6dsv16x";
reg = <0x6a>; /* AD0 = GND */
Expand Down Expand Up @@ -205,12 +230,12 @@ zephyr_udc0: &usbd {
writeoc = "pp4io";
/* MX25U256 supports all readoc options */
readoc = "read4io";
sck-frequency = <32000000>;//最高 48Mhz
sck-frequency = <8000000>;//最高 48Mhz
address-size-32;
enter-4byte-addr = <0xb7>;
jedec-id = [ c2 25 39 ];
sfdp-bfp = [ e5 20 fb ff ff ff ff 0f 44 eb 08 6b 08 3b 04 bb fe ff ff ff ff ff 00 ff ff ff 44 eb 0c 20 0f 52 10 d8 00 ff 25 52 dd 00 84 a5 04 e2 44 03 17 38 30 b0 30 b0 f7 bd d5 5c 4a 9e 29 ff f0 50 f9 85 ];
size = <0x2000000>;// 32M
size = <0x10000000>;// 32MB
has-dpd;
t-enter-dpd = <10000>;
t-exit-dpd = <35000>;
Expand All @@ -235,4 +260,4 @@ zephyr_udc0: &usbd {
};
&gpio1 {
sense-edge-mask = <0x0>;
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,13 @@ config CUSTOM_A6N_INIT_PRIORITY
config CUSTOM_A6N_LOG_LEVEL
int "Logging level"
default 3
range 0 4
range 0 4

config A6N_I1_POLARITY_INVERT
bool "Invert 1bpp→4bpp LUT (1=bright, 0=dark) for clearer text"
default n
help
When set, framebuffer bit 1 → bright (0x0F), bit 0 → dark (0x00).
When clear (default), bit 0 → bright, bit 1 → dark.
Try enabling if 1bpp text appears faint or unclear; then set
display_config invert_colors=0 so text uses white (1) in the buffer.
Loading