Skip to content

Commit

Permalink
wip: fix demo build
Browse files Browse the repository at this point in the history
  • Loading branch information
andelf committed Nov 24, 2024
1 parent 2921d83 commit d939f0c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions examples/hpm6750evkmini/src/bin/raw_pwm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]

use core::ptr::addr_of_mut;

use assign_resources::assign_resources;
use embassy_time::Delay;
use embedded_hal::delay::DelayNs;
Expand All @@ -17,14 +19,15 @@ use {defmt_rtt as _, hpm_hal as hal};
const BOARD_NAME: &str = "HPM5300EVK";
const BANNER: &str = include_str!("../../../assets/BANNER");

static mut UART: Option<hal::uart::Uart<'static, Blocking>> = None;

macro_rules! println {
($($arg:tt)*) => {
let _ = writeln!(unsafe {UART.as_mut().unwrap()}, $($arg)*);
let uart = unsafe { (&mut *(&raw mut UART)).as_mut().unwrap()};
let _ = writeln!(uart , $($arg)*);
};
}

static mut UART: Option<hal::uart::Uart<'static, Blocking>> = None;

assign_resources! {
leds: Led {
r: PB19, // PWM1, CH0
Expand Down
2 changes: 1 addition & 1 deletion examples/hpm6750evkmini/src/bin/spi_st7789.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use hpm_hal::mode::Blocking;
use hpm_hal::spi::{Config, Spi};
use hpm_hal::time::Hertz;
use riscv::delay::McycleDelay;
use {defmt_rtt as _, hpm_hal as hal, panic_halt as _, riscv_rt as _};
use {defmt_rtt as _, hpm_hal as hal, panic_halt as _};

pub struct ST7789<
Spi: SpiDevice,
Expand Down
2 changes: 1 addition & 1 deletion examples/hpm6750evkmini/src/bin/uart_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async fn main(spawner: Spawner) -> ! {
writeln!(uart, "Hello DMA => {:08x}\r\n", hal::pac::HDMA.int_status().read().0).unwrap();

uart.write(b"Hello Async World!\r\n").await.unwrap();
uart.write(b"Type something: ").await.unwrap();
uart.write(b"Type something(4 byte buf): ").await.unwrap();

let mut buf = [0u8; 4];

Expand Down
2 changes: 1 addition & 1 deletion examples/hpm6750evkmini/src/bin/usb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use embassy_usb::Builder;
use futures_util::future::join;
use hal::usb::{Instance, UsbDriver};
use hpm_hal::{bind_interrupts, peripherals};
use {defmt_rtt as _, hpm_hal as hal, riscv_rt as _};
use {defmt_rtt as _, hpm_hal as hal};

bind_interrupts!(struct Irqs {
USB0 => hal::usb::InterruptHandler<peripherals::USB0>;
Expand Down

0 comments on commit d939f0c

Please sign in to comment.