We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Enable
Reset
DAC
pub(crate)
It would be great if there is a HAL for DAC.
The text was updated successfully, but these errors were encountered:
Wrote a working example.
#![no_std] #![no_main] use panic_halt as _; use core::f32::consts::PI; use longan_nano::hal::{delay::McycleDelay, pac, prelude::*}; use riscv_rt::entry; #[entry] fn main() -> ! { let dp = pac::Peripherals::take().unwrap(); dp.RCU.apb1rst.modify(|_, w| w.dacrst().set_bit()); dp.RCU.apb1rst.modify(|_, w| w.dacrst().clear_bit()); dp.RCU.apb1en.modify(|_, w| w.dacen().set_bit()); let mut rcu = dp.RCU.configure().freeze(); let dac = &dp.DAC; let gpioa = dp.GPIOA.split(&mut rcu); let mut pa4 = gpioa.pa4.into_analog(); dac.ctl.write(|w| w.den0().set_bit().dten0().clear_bit()); let mut delay = McycleDelay::new(&rcu.clocks); let mut i = 0; loop { dac.dac0_l12dh.write(|w| unsafe { w.dac0_dh().bits(0xfff) }); delay.delay_ms(3000); dac.dac0_l12dh.write(|w| unsafe { w.dac0_dh().bits(0x000) }); delay.delay_ms(3000); } }
Sorry, something went wrong.
No branches or pull requests
It would be great if there is a HAL for DAC.
The text was updated successfully, but these errors were encountered: