Giter Club home page Giter Club logo

Comments (2)

ASMfreaK avatar ASMfreaK commented on May 27, 2024 1

I'm working on this, soon to release first mwp pr.

from modm.

salkinium avatar salkinium commented on May 27, 2024

For any AVR timer code you would implement a new lbuild module in modm/src/modm/platform/timer/avr/ similar (but less complicated) to the existing stm32 timer implementation including Timer instances as submodules (modm:platform:timer:1 etc).
You will want to check the modm-devices AVR data for device specific instances and type of peripheral.

You would limit the module to AVR platforms only, or even further to only the few devices that you want to support, by returning True or False in the module’s prepare step:

def prepare(module, options):
    device = options[":target"]
    if not device.has_driver("tc:tc*"):
        return False
    if device.identifier.string not in ["atmega328p", "atmega32u4", "atmega2560"]:
        return False
    return True

Make sure to provide at least one example for these devices using this timer, otherwise your code may never be compiled on the CI.

As far as the actual C++ API is concerned, modm doesn’t have an interface for Timers, since we’ve always used them for motor control and that application has always been very specific to the hardware. So for the STM32 timers we’ve created a STM32-specific abstraction, which may not be very useful for AVRs. So don’t feel like you need to provide the same interface, if you’ve found something better. For simple use-cases like PWM an architecture interface would be nice to have though.

Just open a PR and we and the CI can guide you along.

from modm.

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.