Standard Machine API?

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
tannewt
Posts: 51
Joined: Thu Aug 25, 2016 2:43 am

Standard Machine API?

Post by tannewt » Tue Aug 30, 2016 7:33 am

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!

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Standard Machine API?

Post by deshipu » Tue Aug 30, 2016 8:58 am

We recently stumbled on a similar question: https://github.com/micropython/micropython/pull/2283

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Standard Machine API?

Post by dhylands » Tue Aug 30, 2016 3:12 pm

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.

tannewt
Posts: 51
Joined: Thu Aug 25, 2016 2:43 am

Re: Standard Machine API?

Post by tannewt » Tue Aug 30, 2016 5:22 pm

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.

Post Reply