Code Monkey home page Code Monkey logo

Comments (6)

jessebraham avatar jessebraham commented on August 15, 2024 1

I think that's probably the least painful path forward for now. We can always change it later if need be, not the end of the world.

from esp-hal.

jrmoulton avatar jrmoulton commented on August 15, 2024 1

As a note it is possible to construct the spi block as is. A valid gpio type needs to be given. E.g.

    let spi = hal::spi::Spi::new::<
        _,
        _,
        hal::gpio::Gpio0<Input<PullDown>>,
        hal::gpio::Gpio0<Input<PullDown>>,
    >(
        peripherals.SPI2,
        sclk,
        mosi,
        None,
        None,
        2u32.MHz(),
        hal::spi::SpiMode::Mode1,
        &mut pcc,
        &clocks,
    );

Maybe providing a valid No Pin type would be an easier fix. But then the user would have to provide that No Pin type in the generics

from esp-hal.

bjoernQ avatar bjoernQ commented on August 15, 2024

That is what I originally introduced the no-pin type for .

We need a similar solution here

from esp-hal.

bjoernQ avatar bjoernQ commented on August 15, 2024

Something like we have for serial:

/// Pins used by the UART interface
pub trait UartPins {
fn configure_pins(
&mut self,
tx_signal: OutputSignal,
rx_signal: InputSignal,
cts_signal: InputSignal,
rts_signal: OutputSignal,
);
}
/// All pins offered by UART
pub struct AllPins<TX: OutputPin, RX: InputPin, CTS: InputPin, RTS: OutputPin> {
pub tx: Option<TX>,
pub rx: Option<RX>,
pub cts: Option<CTS>,
pub rts: Option<RTS>,
}

from esp-hal.

bjoernQ avatar bjoernQ commented on August 15, 2024

@jessebraham to solve this like we did for UART we need a bunch of constructors which take combinations of the optional pins

while I guess for UART it was sane to have one with all four pins and one with only TX and RX I don't know how to handle this here

IMHO all 4 pins should be optional which gives 16 combinations (well 15 since "no pin at all" doesn't make sense)

maybe not all combinations are really useful but still - should I just make a suggestion of constructors and if we find something is missing, we just add it as a non-breaking change?

from esp-hal.

jessebraham avatar jessebraham commented on August 15, 2024

Closed by #122

from esp-hal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.