rp/gpio: remove generics.

This commit is contained in:
Dario Nieuwenhuis 2024-01-22 21:30:29 +01:00
parent 2bc5e9523d
commit ee0ebe3121
17 changed files with 109 additions and 123 deletions

View file

@ -7,7 +7,7 @@ use defmt::{panic, *};
use embassy_executor::Spawner;
use embassy_net::{Config, Stack, StackResources};
use embassy_rp::gpio::{Level, Output};
use embassy_rp::peripherals::{DMA_CH0, PIN_23, PIN_25, PIO0};
use embassy_rp::peripherals::{DMA_CH0, PIO0};
use embassy_rp::pio::{InterruptHandler, Pio};
use embassy_rp::{bind_interrupts, rom_data};
use static_cell::StaticCell;
@ -24,9 +24,7 @@ const WIFI_NETWORK: &str = "EmbassyTest";
const WIFI_PASSWORD: &str = "V8YxhKt5CdIAJFud";
#[embassy_executor::task]
async fn wifi_task(
runner: cyw43::Runner<'static, Output<'static, PIN_23>, PioSpi<'static, PIN_25, PIO0, 0, DMA_CH0>>,
) -> ! {
async fn wifi_task(runner: cyw43::Runner<'static, Output<'static>, PioSpi<'static, PIO0, 0, DMA_CH0>>) -> ! {
runner.run().await
}

View file

@ -10,7 +10,7 @@ use embassy_net_wiznet::chip::W5100S;
use embassy_net_wiznet::*;
use embassy_rp::clocks::RoscRng;
use embassy_rp::gpio::{Input, Level, Output, Pull};
use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0};
use embassy_rp::peripherals::SPI0;
use embassy_rp::spi::{Async, Config as SpiConfig, Spi};
use embassy_time::Delay;
use embedded_hal_bus::spi::ExclusiveDevice;
@ -23,9 +23,9 @@ async fn ethernet_task(
runner: Runner<
'static,
W5100S,
ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>,
Input<'static, PIN_21>,
Output<'static, PIN_20>,
ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static>, Delay>,
Input<'static>,
Output<'static>,
>,
) -> ! {
runner.run().await

View file

@ -21,7 +21,7 @@ fn read1<const N: usize>(uart: &mut UartRx<'_, impl Instance, Blocking>) -> Resu
Ok(buf)
}
async fn send(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, parity: Option<bool>) {
async fn send(pin: &mut Output<'_>, v: u8, parity: Option<bool>) {
pin.set_low();
Timer::after_millis(1).await;
for i in 0..8 {
@ -116,7 +116,7 @@ async fn main(_spawner: Spawner) {
config.parity = Parity::ParityEven;
let mut uart = UartRx::new_blocking(&mut uart, &mut rx, config);
async fn chr(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, parity: u8) {
async fn chr(pin: &mut Output<'_>, v: u8, parity: u8) {
send(pin, v, Some(parity != 0)).await;
}
@ -142,7 +142,7 @@ async fn main(_spawner: Spawner) {
config.baudrate = 1000;
let mut uart = UartRx::new_blocking(&mut uart, &mut rx, config);
async fn chr(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, good: bool) {
async fn chr(pin: &mut Output<'_>, v: u8, good: bool) {
if good {
send(pin, v, None).await;
} else {

View file

@ -36,7 +36,7 @@ async fn read1<const N: usize>(uart: &mut BufferedUartRx<'_, impl Instance>) ->
}
}
async fn send(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, parity: Option<bool>) {
async fn send(pin: &mut Output<'_>, v: u8, parity: Option<bool>) {
pin.set_low();
Timer::after_millis(1).await;
for i in 0..8 {
@ -161,7 +161,7 @@ async fn main(_spawner: Spawner) {
let rx_buf = &mut [0u8; 16];
let mut uart = BufferedUartRx::new(&mut uart, Irqs, &mut rx, rx_buf, config);
async fn chr(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, parity: u32) {
async fn chr(pin: &mut Output<'_>, v: u8, parity: u32) {
send(pin, v, Some(parity != 0)).await;
}
@ -208,7 +208,7 @@ async fn main(_spawner: Spawner) {
let rx_buf = &mut [0u8; 16];
let mut uart = BufferedUartRx::new(&mut uart, Irqs, &mut rx, rx_buf, config);
async fn chr(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, good: bool) {
async fn chr(pin: &mut Output<'_>, v: u8, good: bool) {
if good {
send(pin, v, None).await;
} else {

View file

@ -27,7 +27,7 @@ async fn read1<const N: usize>(uart: &mut UartRx<'_, impl Instance, Async>) -> R
Ok(buf)
}
async fn send(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, parity: Option<bool>) {
async fn send(pin: &mut Output<'_>, v: u8, parity: Option<bool>) {
pin.set_low();
Timer::after_millis(1).await;
for i in 0..8 {
@ -160,7 +160,7 @@ async fn main(_spawner: Spawner) {
config.parity = Parity::ParityEven;
let mut uart = UartRx::new(&mut uart, &mut rx, Irqs, &mut p.DMA_CH0, config);
async fn chr(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, parity: u32) {
async fn chr(pin: &mut Output<'_>, v: u8, parity: u32) {
send(pin, v, Some(parity != 0)).await;
}
@ -205,7 +205,7 @@ async fn main(_spawner: Spawner) {
config.baudrate = 1000;
let mut uart = UartRx::new(&mut uart, &mut rx, Irqs, &mut p.DMA_CH0, config);
async fn chr(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, good: bool) {
async fn chr(pin: &mut Output<'_>, v: u8, good: bool) {
if good {
send(pin, v, None).await;
} else {