boards/kakute-f7-mini-v3: simple led demo for board testing

Signed-off-by: Onur Özkan <work@onurozkan.dev>
This commit is contained in:
Onur Özkan committed 2026-07-18 14:43:59 +03:00
1 parent bd9fef26e5
commit e0065f8963
5 files changed
+56 -9

No files matched your search

+41 -8
View File
@@ -1,9 +1,10 @@
#![no_std]
#![no_main]
use cortex_m_rt as _;
use panic_halt as _;
#[rtic::app(device = stm32f7::stm32f745, peripherals = true)]
#[rtic::app(device = stm32f7::stm32f722, peripherals = true)]
mod app {
#[shared]
struct Shared {
@@ -13,11 +14,30 @@ mod app {
#[local]
struct Local {
// TODO
led: stm32f7::stm32f722::GPIOD,
led_output_high: bool,
}
#[init]
fn init(_context: init::Context) -> (Shared, Local) {
(Shared {}, Local {})
fn init(context: init::Context) -> (Shared, Local) {
let device = context.device;
device
.RCC
.ahb1enr()
.modify(|_, write| write.gpioden().set_bit());
device
.GPIOD
.moder()
.modify(|_, write| write.moder2().output());
(
Shared {},
Local {
led: device.GPIOD,
led_output_high: false,
},
)
}
#[task(binds = EXTI4, priority = 15)]
@@ -25,12 +45,25 @@ mod app {
// TODO
}
#[idle]
fn idle(_context: idle::Context) -> ! {
// TODO
#[idle(local = [led, led_output_high])]
fn idle(context: idle::Context) -> ! {
loop {
cortex_m::asm::wfi();
if *context.local.led_output_high {
context
.local
.led
.bsrr()
.write(|write| write.br2().set_bit());
} else {
context
.local
.led
.bsrr()
.write(|write| write.bs2().set_bit());
}
*context.local.led_output_high = !*context.local.led_output_high;
cortex_m::asm::delay(8_000_000);
}
}
}