GithubHelp home page GithubHelp logo

khoih-prog / dx_slow_pwm Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 803 KB

This library enables you to use ISR-based PWM channels on Arduino AVRDx-based boards (AVR128Dx, AVR64Dx, AVR32Dx, etc.), using DxCore, to create and output PWM any GPIO pin. It now supports up to 64 ISR-based PWM channels, while consuming only 1 Hardware Timer. PWM channel interval can be very long (ulong microsecs / millisecs). The most important feature is they're ISR-based PWM channels, supporting lower PWM frequencies with suitable accuracy. Their executions are not blocked by bad-behaving functions or tasks. This important feature is absolutely necessary for mission-critical tasks. These ISR-based PWMs, still work even if other software functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software-based PWM using millis() or micros(). That's necessary if you need to control devices requiring high precision. Now you can change the PWM settings on-the-fly.

License: MIT License

C 58.48% C++ 41.21% Shell 0.31%
duty-cycle hardware-timer isr isr-based isr-based-pmw megaavr multi-channel-pwm on-the-fly pwm pwm-driver

dx_slow_pwm's Issues

PWM to drive over 16 channels

Is your feature request related to a problem? Please describe.

if the need is over driving 16 channels, it means we must to use another object for 16 additionnal channels if I m not wrong?
juste to be sure how to process on that case.

So what happen if non other hardware TIMER still available?? (usually One is for millis(), one will be for ISR_Timer interupt generating this PWM, another one can be keep for core operations (in my case NMRA DCC signal management).... so few solution available!
Worst case on megatiny CPU with less TIMER ( A0 B0 B1 only)

Describe the solution you'd like

May it would be possible to limit frequency ( ex between 50hz-120hz range and add PWM channels on the 16 ones on the initial range as a way? (may be not at all!)

Describe alternatives you've considered

using biggest hardware on the family to have enough TCB Timer ressources is the intial possibility if available!

other is to get capacity or possibility to move millis() on a TIMER A type? (not sure it would be well managed by dx core or megacorex and megatinycore?)
May require some additionnal settings according optional links between TIMER A type and B type.

using millis on same timer as the one managing PWM? (stupid way? uncompatible?)

Additional context

optimisation of selected hardware according usages needs specially for limited TIMER numbers.

on exemples PWM_DutyCycle[] comment typo need to set [0;99] percentage

Describe the bug

Comment is

// You can assign any interval for any timer here, in Microseconds
float PWM_DutyCycle[] =
...

May be should be described like for a defined freqency (juste before this step) set the duty cycle according to value range [0;99] (or 100)
(add comment like duty cycle manage light itensity level on an avarage Vout on the define frequzency)
adjust frequency to avoid flikering
adjust ducty cycle for intensity (Vout average)

Steps to Reproduce

N/A

Expected behavior

N/A

MAy be need to precise that some step are requird to use a channel

0 define inital settings
1/ define pin
2/ set frequency
3/ set duty cycle

Actual behavior

N/A

Debug and AT-command log (if applicable)

N/A

Screenshots

If applicable, add screenshots to help explain your problem.

Information

Example

Additional context

Hpp file line 153 TIMER should be TIMER4

Describe the bug

Hpp file line 153 TIMER should be TIMER4

Steps to Reproduce

Steps to reproduce the behavior. Including the MRE sketches

Expected behavior

need to change TIMER3 TIMER4

Actual behavior

TIMER4 defined incorreclty (define as TIMER3 again)

Debug and AT-command log (if applicable)

set TIMER4

Screenshots

N/A

Information

Please ensure to specify the following:

N/A

Additional context

N/A

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.