technoblogy / ulisp-esp

A version of the Lisp programming language for ESP32-based boards.
MIT License
110 stars 37 forks source link

Remappable peripheral pins #78

Open hasn0life opened 1 year ago

hasn0life commented 1 year ago

Hello and thank you for making this wonderful language.

I was wondering if it would be possible to allow the I2Cs and UARTs to do pin remapping on the ESP32 since it supports it. I don't know what a good interface would look like tho, would it be another function or more arguments or optional arguments? Right now I'm modifying the codebase to do it, but maybe that's the best way?

technoblogy commented 1 year ago

The neatest way might be to provide additional optional parameters to with-i2c or with-serial to allow you to specify which pins it should use.

hasn0life commented 1 year ago

I'm not sure because you'd have to specify the pins every time, which is annoying on a microcontroller if you forget or map them wrong. Also if you're moving code or pins you'll have to add it in all the places if you didn't initially use variables for the pins. I'm leaning towards a function to set them once at the beginning, perhaps something like

(defun seti2cpins (sda scl [port])
      ...)
crackwitz commented 1 year ago

Would it be too unreasonable to stick as closely as possible to esp-idf APIs?

dragoncoder047 commented 1 year ago

Would it be too unreasonable to stick as closely as possible to esp-idf APIs?

Well, uLisp is platform-independent, keep in mind that there are versions of it for AVR, ARM, and RISC-V processors as well as ESPs. The SDK's are all different for each processor, so David has tried to simplify so it's the same from this Lisp side on all platforms.

crackwitz commented 1 year ago

My bad. The name made me think this was using espressif APIs. I didn't realize this was actually based on Arduino.