TOPLLab / WARDuino

📟 A dynamic WebAssembly VM for embedded systems
https://topllab.github.io/WARDuino/
Mozilla Public License 2.0
73 stars 7 forks source link

Analog write primitive #190

Closed tolauwae closed 1 year ago

tolauwae commented 1 year ago

Add the analog_write primitive.

tolauwae commented 1 year ago

Out of curiosity is the analogWrite a newly supported function for the ESP32?

I thought so. I'll double check.

If not, that does pose a conundrum. Do all the Arduino primitives need to be supported for the ESP? Ideally, I'd say yes, but the counter argument is that real Arduino devices may want to use this primitives.

That is an annoying decision we will continue to encounter as long as we haven't added a modular system. Don't know on what criteria to decided in those cases.

carllocos commented 1 year ago

@tolauwae I think the analogWrite is indeed new because the reason why I wrote the now-called chip_ledc_set_duty is also because back in the time I could not compile the VM when using analogWrite on the ESP32.

That is an annoying decision we will continue to encounter as long as we haven't added a modular system. Don't know on what criteria to decided in those cases.

Agree so maybe for the time being we should ignore this issue since this will naturally resolve when switching to a modular system.

tolauwae commented 1 year ago

But compilation works this time around. All CI checks are green.

I'll double check if it works for the fade example tomorrow.

tolauwae commented 1 year ago

@carllocos the primitive works fine on ESP32. I actually used it in code for the MobiSys demo.