That actually sounds like a good option, thanks!

On Sun, Mar 30, 2014 at 11:22 PM, comex <com...@gmail.com> wrote:

> On Sun, Mar 30, 2014 at 8:08 AM, Vladimir Pouzanov <farcal...@gmail.com>
> wrote:
> >   gpio::Pin::new(0, 15, gpio::Out, gpio::UART1_TXD); // p13 -> TXD
> >
> > compiles, but something like
> >
> >   gpio::Pin::new(0, 15, gpio::Out, gpio::SPI_MISO); // p13 -> TXD
> >
> > would fail, because there's no SPI_MISO defined for port 0 pin 15.
>
> I would have each port/pin combination be a separate function or
> object which takes an appropriate enum as an argument for the
> function, maybe "fn new_port0_pin15(func: Port0Pin15Func)" or set up
> objects so that "port0.pin15.init(...)" works.  You could use a macro
> to define these more easily.
>
> If you really want to write '(0, 15', you could use a macro to turn
> that into the preceding, but I wouldn't.
>



-- 
Sincerely,
Vladimir "Farcaller" Pouzanov
http://farcaller.net/
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to