diff --git a/boards/matrix_portal_m4/Cargo.toml b/boards/matrix_portal_m4/Cargo.toml index effef4356214..544a37263986 100644 --- a/boards/matrix_portal_m4/Cargo.toml +++ b/boards/matrix_portal_m4/Cargo.toml @@ -32,7 +32,6 @@ features = ["critical-section-single-core"] [dev-dependencies] panic-halt = "0.2" -micromath = "0.5.1" [features] # ask the HAL to enable atsamd51j support diff --git a/boards/matrix_portal_m4/README.md b/boards/matrix_portal_m4/README.md index d3713264a54a..71368d2741af 100644 --- a/boards/matrix_portal_m4/README.md +++ b/boards/matrix_portal_m4/README.md @@ -23,4 +23,7 @@ $ cargo hf2 --release --example blinky_basic --vid 0x239a --pid 0x00c9 Flashing "/Users/User/atsamd/boards/matrix_portal_m4/target/thumbv7em-none-eabihf/release/examples/blinky_basic" Finished in 0.051s $ -``` \ No newline at end of file +``` + +## Matrix Portal M4 +[PCB DOCs](https://github.com/adafruit/Adafruit-MatrixPortal-M4-PCB/tree/main) \ No newline at end of file diff --git a/boards/matrix_portal_m4/examples/pwm.rs b/boards/matrix_portal_m4/examples/pwm.rs index ce1aa4bbe1fc..55d5f64bfc97 100644 --- a/boards/matrix_portal_m4/examples/pwm.rs +++ b/boards/matrix_portal_m4/examples/pwm.rs @@ -8,14 +8,12 @@ use matrix_portal_m4::{entry, hal, Pins, RedLedPwm}; use panic_halt as _; -use core::f32::consts::FRAC_PI_2; use hal::clock::GenericClockController; use hal::delay::Delay; use hal::fugit::RateExtU32; use hal::pac::{CorePeripherals, Peripherals}; use hal::prelude::*; use hal::pwm::{Channel, TCC1Pinout, Tcc1Pwm}; -use micromath::F32Ext; #[entry] fn main() -> ! { @@ -43,12 +41,15 @@ fn main() -> ! { &mut peripherals.MCLK, ); let max_duty = tcc1pwm.get_max_duty(); - let min_duty = 0; + let min_duty = max_duty / 8; loop { + // board led is on channel 2 of tcc1 + // Verfied by looking at adafrult pinout + // https://cdn-learn.adafruit.com/assets/assets/000/111/881/original/led_matrices_Adafruit_MatrixPortal_M4_Pinout.png?1653078587 tcc1pwm.set_duty(Channel::_2, max_duty); delay.delay_ms(1000u16); - tcc1pwm.set_duty(Channel::_2, max_duty / 8); + tcc1pwm.set_duty(Channel::_2, min_duty); delay.delay_ms(1000u16); } } diff --git a/boards/matrix_portal_m4/src/pins.rs b/boards/matrix_portal_m4/src/pins.rs index 5455b4e3bd83..408da8d38f86 100644 --- a/boards/matrix_portal_m4/src/pins.rs +++ b/boards/matrix_portal_m4/src/pins.rs @@ -292,6 +292,7 @@ hal::bsp_pins!( aliases: { PushPullOutput: RedLed, Reset: RedLedReset, + AlternateG: RedLedPwm, } }