From 62ea246ce15519031931270f08b74ef1232a9e9e Mon Sep 17 00:00:00 2001 From: Martin Milata Date: Tue, 8 Apr 2025 16:01:34 +0200 Subject: [PATCH] build(core): allow ble feature in emulator [no changelog] --- core/SConscript.unix | 2 +- core/embed/io/ble/unix/ble.c | 30 +++++++++++++++++++++++++ core/site_scons/models/T3W1/emulator.py | 6 +++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 core/embed/io/ble/unix/ble.c diff --git a/core/SConscript.unix b/core/SConscript.unix index c8724b46df..9a977654f9 100644 --- a/core/SConscript.unix +++ b/core/SConscript.unix @@ -21,7 +21,7 @@ if BENCHMARK and PYOPT != '0': print("BENCHMARK=1 works only with PYOPT=0.") exit(1) -FEATURES_WANTED = ["input", "sd_card", "dma2d", "optiga"] +FEATURES_WANTED = ["input", "sd_card", "dma2d", "optiga", "ble"] if not DISABLE_TROPIC: FEATURES_WANTED.append('tropic') diff --git a/core/embed/io/ble/unix/ble.c b/core/embed/io/ble/unix/ble.c new file mode 100644 index 0000000000..0165da4c8f --- /dev/null +++ b/core/embed/io/ble/unix/ble.c @@ -0,0 +1,30 @@ +#include +#include + +#include + +bool ble_init(void) { return true; } + +void ble_deinit(void) {} + +void ble_start(void) {} + +void ble_stop(void) {} + +bool ble_issue_command(ble_command_t *command) { return true; } + +bool ble_get_event(ble_event_t *event) { return false; } + +void ble_get_state(ble_state_t *state) { + memset(state, 0, sizeof(ble_state_t)); +} + +bool ble_can_write(void) { return true; } + +bool ble_write(const uint8_t *data, uint16_t len) { return len; } + +bool ble_can_read(void) { return false; } + +uint32_t ble_read(uint8_t *data, uint16_t max_len) { return 0; } + +bool ble_get_mac(uint8_t *mac, size_t max_len) { return false; } diff --git a/core/site_scons/models/T3W1/emulator.py b/core/site_scons/models/T3W1/emulator.py index 48e9929667..c97c8bb4c4 100644 --- a/core/site_scons/models/T3W1/emulator.py +++ b/core/site_scons/models/T3W1/emulator.py @@ -87,6 +87,12 @@ def configure( features_available.append("touch") defines += [("USE_TOUCH", "1")] + if "ble" in features_wanted: + sources += ["embed/io/ble/unix/ble.c"] + paths += ["embed/io/ble/inc"] + features_available.append("ble") + defines += [("USE_BLE", "1")] + features_available.append("backlight") defines += [("USE_BACKLIGHT", "1")]