Coder Social home page Coder Social logo

assign-resources's People

Contributors

adamgreig avatar adinack avatar julidi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

adinack julidi

assign-resources's Issues

Only first struct field marked as `pub`

Given the following use of the macro:

    monitoring_adc: MonitoringAdcResources {
        spi: SPI6,
        sck: PA5,
        mosi: // ... etc
    }

the expanded macro (according to rust analyzer, but the compiler errors indicate the same) looks like this

#[allow(dead_code, non_snake_case)]
struct MonitoringAdcResources {
    pub spi: peripherals::SPI6,
    sck: peripherals::PA5,
    mosi:  //...
}

I think all fields should be pub, not just the first one.

And it might be good to have an option to make the entire struct pub. I kept getting errors when using this in a lib and then referencing the structs in the binaries (i.e., the lib has the board definition and the binaries contain programs that use this board).

Unfortunately I am a total macro newbie, but I'd be happy to make a PR if I figure out how to make this work.

Remove `peripherals::` prefix

I was wondering whether there is a specific reason for doing peripherals::$resource_field instead of just $resource_field.
The user will have to use embassy_stm32::peripherals anyway and could just as well do use embassy_stm32::peripherals::* (or not?).

Removing this prefix would make the macro a lot more flexible and allow to include arbitrary resources into it, e.g., an instance of a driver, some array, etc.

Attributes not passed to type aliases

I am trying to reuse the resources struct with a new hardware iteration that has some pin changes. However, I would like to keep the old config around and switch between the assignments with a feature.

Unfortunately, I am not make the macro repeat the feature attribute again before the type alias and I keep getting "the name ResetPin is defined multiple times" errors. Any ideas how this could be fixed?

#[cfg(feature="feat")]
reset: PD7 = ResetPin,
#[cfg(not(feature = "feat"))]
reset: PG3 = ResetPin,

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.