Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(embassy): avoid setting tick feature in hal #36

Merged
merged 3 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ env:

jobs:
build:
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Use nightly Rust
run: |
rustup default nightly-2024-06-12
rustup default nightly
rustup component add rust-src
rustup update
rustup target add riscv32imac-unknown-none-elf
rustup target add riscv32imafc-unknown-none-elf
rustup target add riscv32i-unknown-none-elf
# See https://github.com/rust-lang/rust/issues/12880
touch ~/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/Cargo.lock
- name: Fetch Deps
# if this is a pull request
if: github.event_name == 'pull_request'
Expand Down
12 changes: 4 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ license = "MIT OR Apache-2.0"
ch32-metapac = { features = [
"memory-x",
"rt",
], git = "https://github.com/ch32-rs/ch32-metapac.git", tag = "ch32-data-9839bac87ce756ab19b09c03d89644be401a1c10" }
], git = "https://github.com/ch32-rs/ch32-metapac.git", tag = "ch32-data-0f143d8ce505711e4667002b42b8a34eb9c1d039" }
# ch32-metapac = { features = ["memory-x","rt"], path = "../ch32-data/build/ch32-metapac" }

qingke = { version = "0.2.0", features = ["critical-section-impl"] }
Expand All @@ -36,12 +36,8 @@ critical-section = { version = "1.1.2" }
defmt = { version = "0.3.5", optional = true }
embassy-sync = { version = "0.6.0", optional = true }
embassy-futures = { version = "0.1.1", optional = true }
embassy-time-driver = { version = "0.1.0", features = [
"tick-hz-1_000_000",
], optional = true }
embassy-time = { version = "0.3.0", features = [
"tick-hz-1_000_000",
], optional = true }
embassy-time-driver = { version = "0.1.0", optional = true }
embassy-time = { version = "0.3.0", optional = true }
embassy-usb-driver = "0.1.0"

nb = "1.1.0"
Expand All @@ -56,7 +52,7 @@ sdio-host = "0.5.0"
[build-dependencies]
ch32-metapac = { features = [
"metadata",
], git = "https://github.com/ch32-rs/ch32-metapac.git", tag = "ch32-data-9839bac87ce756ab19b09c03d89644be401a1c10" }
], git = "https://github.com/ch32-rs/ch32-metapac.git", tag = "ch32-data-0f143d8ce505711e4667002b42b8a34eb9c1d039" }
# ch32-metapac = { default-features = false, features = ["metadata"], path = "../ch32-data/build/ch32-metapac" }

proc-macro2 = "1.0.84"
Expand Down
2 changes: 1 addition & 1 deletion examples/ch32l103/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ch32-hal = { path = "../../", features = [
"rt",
"time-driver-tim2"
], default-features = false }
embassy-executor = { version = "0.5.0", features = [
embassy-executor = { version = "0.6.0", features = [
"nightly",
"integrated-timers",
"arch-riscv32",
Expand Down
3 changes: 0 additions & 3 deletions examples/ch32l103/rust-toolchain.toml

This file was deleted.

1 change: 1 addition & 0 deletions examples/ch32l103/src/bin/adc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use ch32_hal as hal;
use embassy_executor::Spawner;
Expand Down
1 change: 1 addition & 0 deletions examples/ch32l103/src/bin/adc_temp.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use ch32_hal as hal;
use embassy_executor::Spawner;
Expand Down
1 change: 1 addition & 0 deletions examples/ch32l103/src/bin/blinky.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use ch32_hal as hal;
use embassy_executor::Spawner;
Expand Down
1 change: 1 addition & 0 deletions examples/ch32l103/src/bin/blinky_raw.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use hal::gpio::{Level, Output};
use qingke::riscv;
Expand Down
4 changes: 1 addition & 3 deletions examples/ch32l103/src/bin/rcc.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use ch32_hal as hal;
use embassy_executor::Spawner;
use embassy_time::{Duration, Timer};
use hal::gpio::{AnyPin, Level, Output, Pin};
use hal::{println, Config};



#[embassy_executor::main(entry = "qingke_rt::entry")]
async fn main(_spawner: Spawner) -> ! {
hal::debug::SDIPrint::enable();
Expand All @@ -20,7 +19,6 @@ async fn main(_spawner: Spawner) -> ! {

println!("Clocks {:?}", hal::rcc::clocks());


// GPIO
let mut led = Output::new(p.PB12, Level::Low, Default::default());

Expand Down
3 changes: 2 additions & 1 deletion examples/ch32v003/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ target = "riscv32ec-unknown-none-elf.json"
runner = "wlink -v flash --enable-sdi-print --watch-serial"

[unstable]
build-std = ["core"] # , "compiler_builtins"]
build-std = ["core"]
# build-std = ["core", "compiler_builtins"]
# build-std-features = ["compiler-builtins-mem"]

[target."riscv32ec-unknown-none-elf"]
Expand Down
2 changes: 1 addition & 1 deletion examples/ch32v003/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ch32-hal = { path = "../../", features = [
"time-driver-tim2",
"rt",
] }
embassy-executor = { version = "0.5.0", features = [
embassy-executor = { version = "0.6.0", features = [
"nightly",
"integrated-timers",
"arch-riscv32",
Expand Down
3 changes: 0 additions & 3 deletions examples/ch32v003/rust-toolchain.toml

This file was deleted.

1 change: 1 addition & 0 deletions examples/ch32v003/src/bin/adc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use hal::delay::Delay;
use hal::gpio::{Level, Output};
Expand Down
1 change: 1 addition & 0 deletions examples/ch32v003/src/bin/blinky.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use hal::delay::Delay;
use hal::gpio::{Level, Output};
Expand Down
1 change: 1 addition & 0 deletions examples/ch32v003/src/bin/embassy_blinky.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use ch32_hal as hal;
use embassy_executor::Spawner;
Expand Down
2 changes: 1 addition & 1 deletion examples/ch32v003/src/bin/gpio_ws2812.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use ch32_hal as hal;
use ch32_hal::gpio::Output;
Expand Down Expand Up @@ -153,7 +154,6 @@ fn main() -> ! {
// to GRB
let color = ((rgb[1] as u32) << 16) | ((rgb[0] as u32) << 8) | (rgb[2] as u32);


ws2812.set_color(color);

Delay.delay_ms(20);
Expand Down
1 change: 1 addition & 0 deletions examples/ch32v003/src/bin/pwm.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use hal::delay::Delay;
use hal::time::Hertz;
Expand Down
2 changes: 1 addition & 1 deletion examples/ch32v003/src/bin/spi-lcd-st7735-cube.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use ch32_hal as hal;
use embedded_graphics::pixelcolor::raw::ToBytes;
use embedded_graphics::pixelcolor::Rgb565;
use embedded_graphics::prelude::*;
use embedded_graphics::primitives::{Line, PrimitiveStyle};

use hal::gpio::{Level, Output, Pin};
use hal::prelude::*;
use hal::spi::Spi;
Expand Down
1 change: 1 addition & 0 deletions examples/ch32v003/src/bin/uart_tx.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use hal::delay::Delay;
use hal::gpio::{Level, Output};
Expand Down
1 change: 1 addition & 0 deletions examples/ch32v003/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#![no_std]
2 changes: 1 addition & 1 deletion examples/ch32v103/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ch32-hal = { path = "../../", features = [
"rt",
"time-driver-tim2",
] }
embassy-executor = { version = "0.5.0", features = [
embassy-executor = { version = "0.6.0", features = [
"nightly",
"integrated-timers",
"arch-riscv32",
Expand Down
3 changes: 0 additions & 3 deletions examples/ch32v103/rust-toolchain.toml

This file was deleted.

5 changes: 3 additions & 2 deletions examples/ch32v103/src/bin/blinky.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use ch32_hal as hal;
use hal::gpio::{Level, Output};
use qingke::riscv;
use hal::println;
use qingke::riscv;

#[qingke_rt::entry]
fn main() -> ! {
Expand All @@ -23,7 +24,7 @@ fn main() -> ! {

#[panic_handler]
fn panic(info: &core::panic::PanicInfo) -> ! {
// let _ = println!("\n\n\n{}", info);
// let _ = println!("\n\n\n{}", info);

loop {}
}
1 change: 1 addition & 0 deletions examples/ch32v103/src/bin/pwm.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use hal::delay::Delay;
use hal::println;
Expand Down
1 change: 1 addition & 0 deletions examples/ch32v103/src/bin/rcc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use ch32_hal as hal;
use hal::delay::Delay;
Expand Down
4 changes: 2 additions & 2 deletions examples/ch32v203/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ ch32-hal = { path = "../../", features = [
# "memory-x",
# "rt",
#], path = "../../../ch32-data/build/ch32-metapac" }
embassy-executor = { version = "0.5.0", features = [
embassy-executor = { version = "0.6.0", features = [
"nightly",
"integrated-timers",
"arch-riscv32",
"executor-thread",
] }
embassy-time = { version = "0.3.0" }
embassy-usb = { version = "0.1.0" }
embassy-usb = { version = "0.3.0" }
embassy-futures = { version = "0.1.0" }

qingke-rt = "0.2.1"
Expand Down
3 changes: 0 additions & 3 deletions examples/ch32v203/rust-toolchain.toml

This file was deleted.

1 change: 1 addition & 0 deletions examples/ch32v203/src/bin/adc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use ch32_hal as hal;
use embassy_executor::Spawner;
Expand Down
1 change: 1 addition & 0 deletions examples/ch32v203/src/bin/blinky.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use hal::gpio::{Level, Output};
use qingke::riscv;
Expand Down
1 change: 1 addition & 0 deletions examples/ch32v203/src/bin/flash_sections.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use ch32_hal as hal;
use embassy_executor::Spawner;
Expand Down
3 changes: 2 additions & 1 deletion examples/ch32v203/src/bin/spi-lcd-st7735.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use core::fmt::Write;

use embassy_executor::Spawner;
Expand All @@ -20,7 +22,6 @@ use embedded_graphics::prelude::*;
use embedded_graphics::primitives::{Line, PrimitiveStyle};
use embedded_graphics::text::{Alignment, Text};
use embedded_hal::delay::DelayNs;

use hal::gpio::{AnyPin, Level, Output, Pin};
use hal::prelude::*;
use hal::spi::Spi;
Expand Down
1 change: 1 addition & 0 deletions examples/ch32v203/src/bin/uart.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use ch32_hal::usart;
use embassy_executor::Spawner;
Expand Down
2 changes: 1 addition & 1 deletion examples/ch32v208/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ch32-hal = { path = "../../", features = [
"embassy",
"rt",
], default-features = false }
embassy-executor = { version = "0.5.0", features = [
embassy-executor = { version = "0.6.0", features = [
"nightly",
"integrated-timers",
"arch-riscv32",
Expand Down
3 changes: 0 additions & 3 deletions examples/ch32v208/rust-toolchain.toml

This file was deleted.

1 change: 1 addition & 0 deletions examples/ch32v208/src/bin/blinky.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use hal::gpio::{Level, Output};
use qingke::riscv;
Expand Down
2 changes: 1 addition & 1 deletion examples/ch32v305/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"

[dependencies]
ch32-hal = { path = "../../", features = ["ch32v305fbp6", "embassy", "rt"] }
embassy-executor = { version = "0.5.0", features = [
embassy-executor = { version = "0.6.0", features = [
"nightly",
"integrated-timers",
"arch-riscv32",
Expand Down
3 changes: 0 additions & 3 deletions examples/ch32v305/rust-toolchain.toml

This file was deleted.

1 change: 1 addition & 0 deletions examples/ch32v305/src/bin/adc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use ch32_hal as hal;
use embassy_executor::Spawner;
Expand Down
1 change: 1 addition & 0 deletions examples/ch32v305/src/bin/blinky.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use embassy_executor::Spawner;
use embassy_time::{Duration, Timer};
Expand Down
Loading
Loading