Add mcu support to the carousel example (#1744)

The carousel example can be now also run on the supported mcu devices
This commit is contained in:
Florian Blasius 2022-10-19 14:54:39 +02:00 committed by GitHub
parent 328cee7289
commit b87705aa56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 126 additions and 62 deletions

View file

@ -1,11 +1,18 @@
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
#![cfg_attr(feature = "mcu", no_std)]
#![cfg_attr(all(feature = "mcu", not(simulator)), no_main)]
#[cfg(feature = "mcu")]
extern crate alloc;
#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
slint::include_modules!();
#[cfg(not(feature = "mcu"))]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen(start))]
pub fn main() {
// This provides better error messages in debug mode.
@ -15,3 +22,12 @@ pub fn main() {
MainWindow::new().run()
}
#[cfg(feature = "mcu")]
#[mcu_board_support::entry]
fn main() -> ! {
mcu_board_support::init();
MainWindow::new().run();
panic!("The MCU demo should not quit")
}