Coder Social home page Coder Social logo

no_std support about midi-msg HOT 4 CLOSED

stuffmatic avatar stuffmatic commented on September 14, 2024
no_std support

from midi-msg.

Comments (4)

AlexCharlton avatar AlexCharlton commented on September 14, 2024 1

Added by #3. 👏 @stuffmatic

Will create a 0.4 release when #4 is merged.

from midi-msg.

AlexCharlton avatar AlexCharlton commented on September 14, 2024

Good idea! Happy to have the contribution :)

from midi-msg.

stuffmatic avatar stuffmatic commented on September 14, 2024

I just got the crate to compile with no_std support, but it turned out to be a bit more work than I anticipated. Here are my findings so far:

  • The ascii crate provides AsciiString in no_std environments if the alloc feature is enabled. However, this feature seems to have been added after the 1.0 release, which means the ascii crate must be fetched from the git repo.
  • There are some math functions that are only available in std. I used the micromath crate, which provides no_std compatible drop in replacements for f32 math functions. Some of these, like powf and log2, are only approximations though, so it would be necessary to verify that the accuracy is good enough.

The above issues seem to (only?) pertain to "exotic" features like sysex, so it might be an option to add cargo feature flags for disabling certain features for no_std builds. This would also provide a way of reducing the binary size, which is useful in resource constrained environments.

I still think it would be really nice if this crate had no_std support, even if it means (at least initially) sacrificing/disabling some features, and I'm happy to work on this if we can find a way forward. It would be interesting to hear your thoughts about this.

from midi-msg.

AlexCharlton avatar AlexCharlton commented on September 14, 2024

Nice findings!

Regarding ascii: I'm not particularly against using a git revision. Perhaps the author of that crate could be convinced to cut a new version, though.

Regarding micromath: I'm not at all opposed. The precision of the math operations performed for this crate is inherently limited by the low bit depth of the numbers they're operating on, so I don't foresee any problems.

So that said, it sounds like we can get to no_std without hiding functionality behind features. I can see the utility in having a reduced binary size too, but I think we can agree that this would best be an additional feature rather than a way of attaining no_std. Certainly the majority of this crate lives under SystemExclusiveMsg so that would be a natural cut-point for sure. So yeah, I'd also be open to a no_sysex feature.

from midi-msg.

Related Issues (5)

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.