This commit is contained in:
Jacob Rosenthal 2021-11-11 19:58:45 -07:00
parent fe83daf45f
commit 639034cee4

View File

@ -14,7 +14,7 @@ use embassy_nrf::Peripherals;
#[embassy::main] #[embassy::main]
async fn main(_spawner: Spawner, p: Peripherals) { async fn main(_spawner: Spawner, p: Peripherals) {
// for i in range(1024): print(int((math.sin(i/512*math.pi)*0.4+0.5)**2*32767), ', ', end='') // for i in range(1024): print(int((math.sin(i/512*math.pi)*0.4+0.5)**2*32767), ', ', end='')
let seq_values: [u16; 1024] = [ let mut seq_values: [u16; 1024] = [
8191, 8272, 8353, 8434, 8516, 8598, 8681, 8764, 8847, 8931, 9015, 9099, 9184, 9269, 9354, 8191, 8272, 8353, 8434, 8516, 8598, 8681, 8764, 8847, 8931, 9015, 9099, 9184, 9269, 9354,
9440, 9526, 9613, 9700, 9787, 9874, 9962, 10050, 10139, 10227, 10316, 10406, 10495, 10585, 9440, 9526, 9613, 9700, 9787, 9874, 9962, 10050, 10139, 10227, 10316, 10406, 10495, 10585,
10675, 10766, 10857, 10948, 11039, 11131, 11223, 11315, 11407, 11500, 11592, 11685, 11779, 10675, 10766, 10857, 10948, 11039, 11131, 11223, 11315, 11407, 11500, 11592, 11685, 11779,
@ -98,7 +98,13 @@ async fn main(_spawner: Spawner, p: Peripherals) {
config.refresh = 3; config.refresh = 3;
let pwm = unwrap!(SequencePwm::new( let pwm = unwrap!(SequencePwm::new(
p.PWM0, p.P0_13, NoPin, NoPin, NoPin, config, seq_values p.PWM0,
p.P0_13,
NoPin,
NoPin,
NoPin,
config,
&mut seq_values
)); ));
let _ = pwm.start(SequenceMode::Infinite); let _ = pwm.start(SequenceMode::Infinite);
info!("pwm started!"); info!("pwm started!");