Has a library been created yet that will produce software PWM on the Due?
I tried using the library from the Arduino website: SoftPWM
but I keep getting an error that it can't find avr\io.h. After doing some research I've learned that that is pertaining to the AVR chip on the mega and is not used for the atmel on the Due so they can be removed. When I do that, it starts complaining about the code itself in the SoftPWM library. So, is there a library that accommodates the Due or is there an issue in the compiler that needs to be addressed before it can be done smoothly?
How many lines are you needing? Might be easier to hack the shield but then you'd also have to hack the TFT library. Henning Karlssen's stuff is fairly nice to follow.
I'm using this shield: http://www.robotshop.com/en/3-2-tft-lcd-touch-shield-arduino.html
Over another shield that utilizes a ds3234 rtc, a xbee wifi module, a buzzer, 2 rj45 connectors for some peripheral connections, one requiring 8 PWM channels, and several more I/O ports for various sensors. I'm using that shield because it covers everything nicely without requiring extra supports to keep it from bending like other tft shields I've seen. When all is said and done, I need to use some digital ports for software pwm, but I'm assuming by these comments there isn't one.
rmetzner49:
Henning Karlssen's stuff is fairly nice to follow.
I'm already using the UTFT libraries. My compinents won't allow me to adjust pin placement very easily. My easiest route is software pwm which I'm sure the Due is more than capable of handling especially since people do it on the Uno and Mega.
I removed the avr/io.h and avr/interrupt.h since they don't pertain to the Due, but of course that removes the support for the timer in the SoftPWM library. Is there a way to convert this so it uses the Due timers instead of the avr timers?
I ported SoftPWM (and many other libraries) to Teensy 3.1 within the last year.
Due has very different timers, so none of that work will help directly. But it can at least give anyone who tries a head-start to identify the places that need porting to move from AVR to ARM.