ryansuchocki / microscheme

A Scheme subset for Atmel microcontrollers.
http://ryansuchocki.github.io/microscheme/
MIT License
300 stars 20 forks source link

Add support for the Keyboardio Atreus #36

Open hexbyte-de opened 3 years ago

hexbyte-de commented 3 years ago

This adds the Keyboardio Atreus as new model to be able to build Menelaus for it. This is necessary, because the Keyboardio Atreus uses 3 pins that aren't provided by the LEO, in contrast to the original design by @technomancy.

This is marked as draft, because I don't know if there is an LED on the PCB that can be used for exception indication. I don't assume there is, but want to make sure before this gets merged. @keyboardio could you help me out with this question, please?

Except from that, everything works as expected, is ready for review and can be tested with this branch: https://git.sr.ht/~hexbyte/menelaus/tree/keyboardio-atreus

technomancy commented 3 years ago

If this isn't a good fit for inclusion in microscheme, maybe it would be better to call (set! arduino-pins ...) and (set! arduino-ports ...) from menelaus instead?

hexbyte-de commented 3 years ago

@technomancy Come to think of it, my changes add an arbitrary mapping between microscheme pin numbers and real pins. Considering @ryansuchocki's comment https://github.com/ryansuchocki/microscheme/pull/21#issuecomment-168361156, setting the ports and pins in menelaus sounds like the cleaner solution.

ryansuchocki commented 3 years ago

Apologies for staying quiet so long. Did you work out what to do about the debug LED?

w.r.t. pin mappings, I think the ideal solution would be to add a generic "raw 32u4" model a la #21, and then define Atreus-specific mappings downstream. The advantages of this would be that (A) others can benefit from the raw model and (B) you can update the mappings in future without requiring a ms release.

However, if that can't be done then I'm happy to merge whatever you have.

hexbyte-de commented 3 years ago

I just received an answer from keyboardio and there is no onboard LED, so I'll remove the draft state.

@technomancy: Setting the pins and port in menelaus also works for me. If it is not too hacky for you, I'm perfectly happy with this solution. Maybe this is how I would have implemented it initially, if I had any prior practical experience with Scheme (or Lisp in general).

A raw mode would be ideal and maybe I find the time to add it someday, but at the moment I can't promise that. I don't have any preference, how we add the pin definitions now. In the end, it comes down to what you both prefer for Microscheme and Menelaus.

technomancy commented 3 years ago

I finally got around to loading Microscheme on my Keyboardio Atreus, and this PR works great for that. But I think the "raw 32u4" model makes more sense as a general-purpose thing to ship with micrscheme.

Putting the pin mappings in Menelaus makes plenty of sense, and it would open this up to being used on other non-Arudino chips.