nrf: remove OptionalPin
This commit is contained in:
@ -85,7 +85,7 @@ static DUTY: [u16; 1024] = [
|
||||
|
||||
#[embassy::main]
|
||||
async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
let mut pwm = SimplePwm::new(p.PWM0, p.P0_13, p.P0_14, p.P0_16, p.P0_15);
|
||||
let mut pwm = SimplePwm::new_4ch(p.PWM0, p.P0_13, p.P0_14, p.P0_16, p.P0_15);
|
||||
pwm.set_prescaler(Prescaler::Div1);
|
||||
pwm.set_max_duty(32767);
|
||||
info!("pwm initialized!");
|
||||
|
@ -7,7 +7,6 @@ mod example_common;
|
||||
use defmt::*;
|
||||
use embassy::executor::Spawner;
|
||||
use embassy::time::{Duration, Timer};
|
||||
use embassy_nrf::gpio::NoPin;
|
||||
use embassy_nrf::pwm::{
|
||||
Config, Prescaler, Sequence, SequenceConfig, SequenceMode, SequencePwm, Sequencer,
|
||||
StartSequence,
|
||||
@ -29,9 +28,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
seq_config.refresh = 624;
|
||||
// thus our sequence takes 5 * 5000ms or 25 seconds
|
||||
|
||||
let mut pwm = unwrap!(SequencePwm::new(
|
||||
p.PWM0, p.P0_13, NoPin, NoPin, NoPin, config,
|
||||
));
|
||||
let mut pwm = unwrap!(SequencePwm::new_1ch(p.PWM0, p.P0_13, config));
|
||||
|
||||
let sequence_0 = Sequence::new(&seq_words_0, seq_config.clone());
|
||||
let sequence_1 = Sequence::new(&seq_words_1, seq_config);
|
||||
|
@ -7,7 +7,6 @@ mod example_common;
|
||||
use defmt::*;
|
||||
use embassy::executor::Spawner;
|
||||
use embassy::time::{Duration, Timer};
|
||||
use embassy_nrf::gpio::NoPin;
|
||||
use embassy_nrf::pwm::{
|
||||
Config, Prescaler, SequenceConfig, SequencePwm, SingleSequenceMode, SingleSequencer,
|
||||
};
|
||||
@ -27,9 +26,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
seq_config.refresh = 624;
|
||||
// thus our sequence takes 5 * 5000ms or 25 seconds
|
||||
|
||||
let mut pwm = unwrap!(SequencePwm::new(
|
||||
p.PWM0, p.P0_13, NoPin, NoPin, NoPin, config,
|
||||
));
|
||||
let mut pwm = unwrap!(SequencePwm::new_1ch(p.PWM0, p.P0_13, config,));
|
||||
|
||||
let sequencer = SingleSequencer::new(&mut pwm, &seq_words, seq_config);
|
||||
unwrap!(sequencer.start(SingleSequenceMode::Times(1)));
|
||||
|
@ -8,7 +8,7 @@ mod example_common;
|
||||
use core::future::pending;
|
||||
use defmt::*;
|
||||
use embassy::executor::Spawner;
|
||||
use embassy_nrf::gpio::{Input, NoPin, Pull};
|
||||
use embassy_nrf::gpio::{Input, Pull};
|
||||
use embassy_nrf::gpiote::{InputChannel, InputChannelPolarity};
|
||||
use embassy_nrf::ppi::Ppi;
|
||||
use embassy_nrf::pwm::{
|
||||
@ -29,9 +29,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
let mut seq_config = SequenceConfig::default();
|
||||
seq_config.refresh = 30;
|
||||
|
||||
let mut pwm = unwrap!(SequencePwm::new(
|
||||
p.PWM0, p.P0_13, NoPin, NoPin, NoPin, config,
|
||||
));
|
||||
let mut pwm = unwrap!(SequencePwm::new_1ch(p.PWM0, p.P0_13, config));
|
||||
|
||||
// pwm.stop() deconfigures pins, and then the task_start_seq0 task cant work
|
||||
// so its going to have to start running in order load the configuration
|
||||
|
@ -7,7 +7,6 @@ mod example_common;
|
||||
use defmt::*;
|
||||
use embassy::executor::Spawner;
|
||||
use embassy::time::{Duration, Timer};
|
||||
use embassy_nrf::gpio::NoPin;
|
||||
use embassy_nrf::pwm::{
|
||||
Config, Prescaler, SequenceConfig, SequenceLoad, SequencePwm, SingleSequenceMode,
|
||||
SingleSequencer,
|
||||
@ -35,9 +34,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
config.sequence_load = SequenceLoad::Common;
|
||||
config.prescaler = Prescaler::Div1;
|
||||
config.max_duty = 20; // 1.25us (1s / 16Mhz * 20)
|
||||
let mut pwm = unwrap!(SequencePwm::new(
|
||||
p.PWM0, p.P1_05, NoPin, NoPin, NoPin, config,
|
||||
));
|
||||
let mut pwm = unwrap!(SequencePwm::new_1ch(p.PWM0, p.P1_05, config));
|
||||
|
||||
// Declare the bits of 24 bits in a buffer we'll be
|
||||
// mutating later.
|
||||
|
@ -7,13 +7,12 @@ mod example_common;
|
||||
use defmt::*;
|
||||
use embassy::executor::Spawner;
|
||||
use embassy::time::{Duration, Timer};
|
||||
use embassy_nrf::gpio::NoPin;
|
||||
use embassy_nrf::pwm::{Prescaler, SimplePwm};
|
||||
use embassy_nrf::Peripherals;
|
||||
|
||||
#[embassy::main]
|
||||
async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
let mut pwm = SimplePwm::new(p.PWM0, p.P0_05, NoPin, NoPin, NoPin);
|
||||
let mut pwm = SimplePwm::new_1ch(p.PWM0, p.P0_05);
|
||||
// sg90 microervo requires 50hz or 20ms period
|
||||
// set_period can only set down to 125khz so we cant use it directly
|
||||
// Div128 is 125khz or 0.000008s or 0.008ms, 20/0.008 is 2500 is top
|
||||
|
@ -7,7 +7,6 @@ mod example_common;
|
||||
use example_common::*;
|
||||
|
||||
use embassy::executor::Spawner;
|
||||
use embassy_nrf::gpio::NoPin;
|
||||
use embassy_nrf::{interrupt, uarte, Peripherals};
|
||||
|
||||
#[embassy::main]
|
||||
@ -17,7 +16,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
config.baudrate = uarte::Baudrate::BAUD115200;
|
||||
|
||||
let irq = interrupt::take!(UARTE0_UART0);
|
||||
let mut uart = uarte::Uarte::new(p.UARTE0, irq, p.P0_08, p.P0_06, NoPin, NoPin, config);
|
||||
let mut uart = uarte::Uarte::new(p.UARTE0, irq, p.P0_08, p.P0_06, config);
|
||||
|
||||
info!("uarte initialized!");
|
||||
|
||||
|
@ -7,7 +7,6 @@ mod example_common;
|
||||
use example_common::*;
|
||||
|
||||
use embassy::executor::Spawner;
|
||||
use embassy_nrf::gpio::NoPin;
|
||||
use embassy_nrf::{interrupt, uarte, Peripherals};
|
||||
|
||||
#[embassy::main]
|
||||
@ -18,7 +17,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
|
||||
let irq = interrupt::take!(UARTE0_UART0);
|
||||
let mut uart = uarte::UarteWithIdle::new(
|
||||
p.UARTE0, p.TIMER0, p.PPI_CH0, p.PPI_CH1, irq, p.P0_08, p.P0_06, NoPin, NoPin, config,
|
||||
p.UARTE0, p.TIMER0, p.PPI_CH0, p.PPI_CH1, irq, p.P0_08, p.P0_06, config,
|
||||
);
|
||||
|
||||
info!("uarte initialized!");
|
||||
|
@ -10,7 +10,6 @@ use embassy::blocking_mutex::kind::Noop;
|
||||
use embassy::channel::mpsc::{self, Channel, Sender};
|
||||
use embassy::executor::Spawner;
|
||||
use embassy::util::Forever;
|
||||
use embassy_nrf::gpio::NoPin;
|
||||
use embassy_nrf::peripherals::UARTE0;
|
||||
use embassy_nrf::uarte::UarteRx;
|
||||
use embassy_nrf::{interrupt, uarte, Peripherals};
|
||||
@ -24,7 +23,7 @@ async fn main(spawner: Spawner, p: Peripherals) {
|
||||
config.baudrate = uarte::Baudrate::BAUD115200;
|
||||
|
||||
let irq = interrupt::take!(UARTE0_UART0);
|
||||
let uart = uarte::Uarte::new(p.UARTE0, irq, p.P0_08, p.P0_06, NoPin, NoPin, config);
|
||||
let uart = uarte::Uarte::new(p.UARTE0, irq, p.P0_08, p.P0_06, config);
|
||||
let (mut tx, rx) = uart.split();
|
||||
|
||||
let c = CHANNEL.put(Channel::new());
|
||||
|
Reference in New Issue
Block a user