Help reviewing analog-write-resolution patch for library

I’d like some review of the patch I wrote (cf. Possible to increase the PWM resolution? ). Then I’ll update my xod library release.

Can anyone provide some review?

  • I only output “ready”. It seems that is a good idea. Is something else important?
  • Improve the documentation.
  • Improve the code, especially for detecting which boards it works on.
  • I’ve been away from XOD for a while, should I have more c++ api stuff?
  • Is there some similar patch, that only works on certain boards, that I could model this upon?
  • Do I really need to do “if error” etc. in the c++?
  • A better example? (I find a visual test of slowly stepping to be a better verification).

Could you not do it so the software knows the limitation of the card you connect and you only have the settings for the card you connect.

Maybe a warning if you have set the PWM frequency higer then the card can handel, it will change frequency automatically. And a pop-up will aper. For example for for uno it will say that higer pwm is limited for 2 outputs, and so on and so on.

The hole reason I found this program is that I can’t program. Dyslexic and so on.

Then you need alot of help to solve eaven the simplest things.

Best regards Jacob

Not sure what you mean. If you are talking about Arduino boards, there is limited information for the software to figure things out. For example, this patch can tell if the board is a SAMD, or not. I didn’t see a reliable way of telling the maximum number of bits of resolution. Or even a standard “Does this board support analogWriteResolution()?” answer.

If someone knows how to get the bit possibilities programmatically (and is not a special case per manufacturer’s board), please tell me for inclusion.

This patch only does resolution, not frequency. I agree that the system should help you to get the possible values correct. But, neither the Arduino IDE, nor XOD, have a mechanism like you suggest.

I am also not interested in writing special cases for each manufacturers board. Compare with GitHub - ocrdu/Arduino_SAMD21_turbo_PWM: Fast-PWM library for SAMD21-based Arduinos. which has cases for many boards, but may not work on the ItsyBitsy(s), because the Arduino environment doesn’t have the generic support.

I agree! Not everyone needs to become an expert real-time embedded programmer in c++. The Arduino IDE made some progress. But, maybe things like XOD can give better access.

This is way over my understanding.

But I understand that PWM out with only 255 is to little resolution for diming leds in the lower end,

Then I tried to understand if ther was some way to change that on a arduino UNO, and found it to be complicated and not on all ports I need.

Someone els could probably give better answers, butt you probably understand what I am loking for.

Published as awgrover/analog-write-resolution — XOD .