diff --git a/docs/hardware_platform_support.md b/docs/hardware_platform_support.md index 4e585f192..3c0c496bb 100644 --- a/docs/hardware_platform_support.md +++ b/docs/hardware_platform_support.md @@ -31,6 +31,7 @@ Current profiles in `io_config.json`: - `FOX_22` (Luckfox Pico 22-pin) - `FOX_40` (Luckfox Pico 40-pin) - `FOX_PI` (Luckfox Pico Pi) +- `LC_LAFRITE` (Libre Computer La Frite AML-S805X-AC, USB camera) ## Button GPIO mapping format @@ -166,3 +167,25 @@ This is a quick reference summary of the mappings currently defined in - Device: `/dev/video12` - Pixel format: `GREY` - Framerate: `6` + +### `LC_LAFRITE` + +- Display (sysfs GPIO numbers; 7J1 header, Waveshare-compatible physical pin positions): + - `dc`: `[480]` (pin 22, GPIOX_0) + - `rst`: `[510]` (pin 13, GPIOAO_9) + - `bl`: `[495]` (pin 18, GPIOX_15) + - SPI: `bus 0`, `device 0` +- Buttons (all with `"pull_up"`; sysfs GPIO numbers): + - `KEY_UP`: `[498, "pull_up"]` (pin 31, GPIOX_18) + - `KEY_DOWN`: `[487, "pull_up"]` (pin 35, GPIOX_7) + - `KEY_LEFT`: `[497, "pull_up"]` (pin 29, GPIOX_17) + - `KEY_RIGHT`: `[485, "pull_up"]` (pin 37, GPIOX_5) + - `KEY_PRESS`: `[486, "pull_up"]` (pin 33, GPIOX_6) + - `KEY1`: `[484, "pull_up"]` (pin 40, GPIOX_4) + - `KEY2`: `[483, "pull_up"]` (pin 38, GPIOX_3) + - `KEY3`: `[482, "pull_up"]` (pin 36, GPIOX_2) +- Camera (USB): + - Device: `/dev/video0` + - Resolution: `1280x720` + - Pixel format: `YUYV` + - Framerate: `4` diff --git a/docs/io_config.md b/docs/io_config.md index 6984c9fda..cc616d20e 100644 --- a/docs/io_config.md +++ b/docs/io_config.md @@ -65,6 +65,7 @@ Values shown are exactly how mappings are stored in `io_config.json`. | `FOX_22` | `luckfox_22` | `[52] / [51] / [43]` | `KEY_UP [57,"pull_up"]`, `KEY_DOWN [59,"pull_up"]`, `KEY_LEFT [56,"pull_up"]`, `KEY_RIGHT [54,"pull_up"]`, `KEY_PRESS [58,"pull_up"]`, `KEY1 [55,"pull_up"]`, `KEY2 [4,"pull_up"]`, `KEY3 [53,"pull_up"]` | `/dev/video12`, `GREY`, `6fps` | | `FOX_40` | `luckfox_40` | `[56] / [57] / [72]` | `KEY_UP [58,"pull_up"]`, `KEY_DOWN [53,"pull_up"]`, `KEY_LEFT [59,"pull_up"]`, `KEY_RIGHT [54,"pull_up"]`, `KEY_PRESS [52,"pull_up"]`, `KEY1 [55,"pull_up"]`, `KEY2 [43,"pull_up"]`, `KEY3 [42,"pull_up"]` | `/dev/video12`, `GREY`, `6fps` | | `FOX_PI` | `luckfox_pi` | `[59] / [56] / [70]` | `KEY_UP [121,"pull_up"]`, `KEY_DOWN [1,"pull_up"]`, `KEY_LEFT [122,"pull_up"]`, `KEY_RIGHT [0,"pull_up"]`, `KEY_PRESS [52,"pull_up"]`, `KEY1 [145,"pull_up"]`, `KEY2 [123,"pull_up"]`, `KEY3 [55,"pull_up"]` | `/dev/video12`, `GREY`, `6fps` | +| `LC_LAFRITE` | `lc_lafrite` | `[480] / [510] / [495]` | `KEY_UP [498,"pull_up"]`, `KEY_DOWN [487,"pull_up"]`, `KEY_LEFT [497,"pull_up"]`, `KEY_RIGHT [485,"pull_up"]`, `KEY_PRESS [486,"pull_up"]`, `KEY1 [484,"pull_up"]`, `KEY2 [483,"pull_up"]`, `KEY3 [482,"pull_up"]` | `/dev/video0`, `1280x720`, `YUYV`, `4fps` | --- diff --git a/src/seedsigner/hardware/io_config.json b/src/seedsigner/hardware/io_config.json index 534865b80..2ffb27edb 100644 --- a/src/seedsigner/hardware/io_config.json +++ b/src/seedsigner/hardware/io_config.json @@ -264,6 +264,71 @@ "framerate": 6 } }, + { + "platform": "Libre Computer", + "variant": "La Frite (AML-S805X-AC)", + "shortname": "LC_LAFRITE", + "runtime_profile": "lc_lafrite", + "regex": [ + "libre computer aml-s805x-ac" + ], + "display": { + "dc": [ + 480 + ], + "rst": [ + 510 + ], + "bl": [ + 495 + ], + "spi_bus": 0, + "spi_device": 0 + }, + "buttons": { + "KEY_UP": [ + 498, + "pull_up" + ], + "KEY_DOWN": [ + 487, + "pull_up" + ], + "KEY_LEFT": [ + 497, + "pull_up" + ], + "KEY_RIGHT": [ + 485, + "pull_up" + ], + "KEY_PRESS": [ + 486, + "pull_up" + ], + "KEY1": [ + 484, + "pull_up" + ], + "KEY2": [ + 483, + "pull_up" + ], + "KEY3": [ + 482, + "pull_up" + ] + }, + "camera": { + "device": "/dev/video0", + "resolution": [ + 1280, + 720 + ], + "pixelformat": "YUYV", + "framerate": 4 + } + }, { "platform": "Luckfox Pico", "variant": "Pi", diff --git a/tests/test_io_config_profiles.py b/tests/test_io_config_profiles.py index 244d516fb..3afd54664 100644 --- a/tests/test_io_config_profiles.py +++ b/tests/test_io_config_profiles.py @@ -9,6 +9,43 @@ def test_runtime_profile_to_hardware_profile_luckfox_pico_pi(): assert runtime_profile_to_hardware_profile("luckfox_pi") == "FOX_PI" +def test_detect_runtime_profile_libre_computer_lafrite(): + assert detect_runtime_profile("Libre Computer AML-S805X-AC La Frite") == "lc_lafrite" + + +def test_runtime_profile_to_hardware_profile_libre_computer_lafrite(): + assert runtime_profile_to_hardware_profile("lc_lafrite") == "LC_LAFRITE" + + +def test_lc_lafrite_display_control_lines(): + mapping = get_hardware_pin_mapping("LC_LAFRITE") + + assert mapping["display"]["dc"] == [480] + assert mapping["display"]["rst"] == [510] + assert mapping["display"]["bl"] == [495] + + +def test_lc_lafrite_buttons_use_pull_up_mapping(): + mapping = get_hardware_pin_mapping("LC_LAFRITE") + + assert mapping["buttons"]["KEY_UP"] == [498, "pull_up"] + assert mapping["buttons"]["KEY_DOWN"] == [487, "pull_up"] + assert mapping["buttons"]["KEY_LEFT"] == [497, "pull_up"] + assert mapping["buttons"]["KEY_RIGHT"] == [485, "pull_up"] + assert mapping["buttons"]["KEY_PRESS"] == [486, "pull_up"] + assert mapping["buttons"]["KEY1"] == [484, "pull_up"] + assert mapping["buttons"]["KEY2"] == [483, "pull_up"] + assert mapping["buttons"]["KEY3"] == [482, "pull_up"] + + +def test_lc_lafrite_camera_uses_usb_device(): + mapping = get_hardware_pin_mapping("LC_LAFRITE") + + assert mapping["camera"]["device"] == "/dev/video0" + assert mapping["camera"]["pixelformat"] == "YUYV" + assert mapping["camera"]["framerate"] == 4 + + def test_fox_pi_display_control_lines_match_waveshare_hat_pins(): mapping = get_hardware_pin_mapping("FOX_PI")