Page 1 of 1

Standard Machine API?

Posted: Tue Aug 30, 2016 7:33 am
by tannewt
Whats the thinking on the machine API compatibility across ports? I'm porting micropython to the SAMD21x18 which is on the Arduino Zero. Specifically, I'm adding PWM support to the port but I'm unsure which approach to take.

The ESP8266 has a PWM class while the Teensy and STMHAL have separate timer classes that seem to reflect the underlying system. The Teensy and STMHAL approach is great for using micropython as a proxy for the underlying code but bad for portability of both code and tutorials.

If there is a standard API where is it documented? Thanks!

Re: Standard Machine API?

Posted: Tue Aug 30, 2016 8:58 am
by deshipu
We recently stumbled on a similar question: https://github.com/micropython/micropython/pull/2283

Re: Standard Machine API?

Posted: Tue Aug 30, 2016 3:12 pm
by dhylands
The documentation, such as it is, for the machine module is here:
https://github.com/micropython/micropyt ... rdware-API

Personally, I would continue to make it part of the Timer module. We've had long discussions about this on github in the past.

Re: Standard Machine API?

Posted: Tue Aug 30, 2016 5:22 pm
by tannewt
deshipu, perfect. I followed up there with my thoughts.

dhylands, thanks! I had seen that in the past but I'll look again and make sure my port is compatible. I think its getting close to what I was thinking where there are low level classes specific to the hardware and high level classes that aren't.