-
-
Save metajack/d9b2a0acd9e099d702dadee700c164fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mut pwm = Pca9685::new(i2c, 0x40).unwrap(); | |
pwm.enable().unwrap(); | |
pwm.set_output_driver(pwm_pca9685::OutputDriver::TotemPole).unwrap(); | |
pwm.set_output_logic_state(pwm_pca9685::OutputLogicState::Inverted).unwrap(); | |
pwm.set_disabled_output_value(pwm_pca9685::DisabledOutputValue::HighImpedance).unwrap(); | |
pwm.enable_register_autoincrement().unwrap(); | |
// dma the led states | |
let mut i2c = pwm.destroy(); | |
i2c.tx_dma(true); | |
let streams = StreamsTuple::new(dp.DMA1, ccdr.peripheral.DMA1); | |
let config = DmaConfig::default(); | |
let mut transfer: Transfer<_, _, MemoryToPeripheral, _, _> = Transfer::init( | |
streams.6, | |
i2c, | |
unsafe { transmute::<&mut LedArray, &mut [u8; 65]>(&mut LED_BUFFER) }, | |
None, | |
config, | |
); | |
transfer.start(|i2c| { | |
i2c.master_write(0x00, 65, i2c::Stop::Automatic); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment