Code Monkey home page Code Monkey logo

Comments (2)

golemparts avatar golemparts commented on September 27, 2024

Thanks for the suggestion! While RPPAL doesn't currently provide that functionality, It would technically be possible to combine register writes for multiple pins. I can imagine a batch_write function (and possibly a batch_read) that takes a list of OutputPins and states, and combines those into fewer writes.

The BCM2711 uses 4 registers to set/clear pin states (GPSET0, GPSET1, GPCLR0, GPCLR1). In the worst case scenario you'd go from writing 6 32-bit values to 4 (possibly as a single 128-bit write), plus the overhead (either in the library or the end-user code) of sorting through the list of pins. I think it's worth implementing as a convenience function for parallel interfaces, with any performance gains as a bonus.

I'll put this on the list of requested changes and see if we can get it into a future update.

from rppal.

superlou avatar superlou commented on September 27, 2024

Thanks for considering it. I'm actually getting pretty acceptable performance from what I can tell (though I don't have a logic analyzer at home for my hobby projects) setting them one at a time. If it's just a convenience function, I can just write a wrapper that takes an array of pins. In hindsight, trying to set them via the set/clear registers potentially adds a lot of support work since it might be unique to each Raspberry PI SOC.

from rppal.

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.