Hello. I was finally able to implement something in ulisp, it’s not much but it’s important to me. For the esp32 implement the function touchRead(GPIO);
indent preformatted text by 4 spaces
const char string230[] PROGMEM = "touchread";
const char doc221[] PROGMEM = "(touchread pin)\n";
{ string230, fn_touchread, 0x11, doc221 },
object *fn_touchread (object *args, object *env) {
(void) env;
int pin;
object *arg = first(args);
if (keywordp(arg)) pin = checkkeyword(TOUCHREAD, arg);
else {
pin = checkinteger(TOUCHREAD, arg);
checktouchread(pin);
}
return number(touchRead(pin));
}
y el checkeo de los pines todavia incompleto
void checktouchread (int pin) {
#if defined(ESP8266)
if (pin!=17) error(ANALOGREAD, PSTR("invalid pin"), number(pin));
#elif defined(ESP32)
if (!(pin==0 || pin==2 || pin==3 ||(pin>=4 && pin<=6) ))
error(TOUCHREAD, PSTR("invalid pin"), number(pin));
#elif defined(ARDUINO_FEATHER_ESP32)
if (!(pin==4 || (pin>=12 && pin<=15) || (pin>=25 && pin<=27) || (pin>=32 && pin<=36) || pin==39))
error(ANALOGREAD, PSTR("invalid pin"), number(pin));
#elif defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2)
if (!(pin==8 || (pin>=14 && pin<=18))) error(ANALOGREAD, PSTR("invalid pin"), number(pin));
#elif defined(ARDUINO_ADAFRUIT_QTPY_ESP32S2)
if (!((pin>=5 && pin<=9) || (pin>=16 && pin<=18))) error(ANALOGREAD, PSTR("invalid pin"), number(pin));
#elif defined(ARDUINO_ADAFRUIT_QTPY_ESP32C3)
if (!((pin>=0 && pin<=1) || (pin>=3 && pin<=5))) error(ANALOGREAD, PSTR("invalid pin"), number(pin));
#elif defined(ARDUINO_FEATHERS2) | defined(ARDUINO_ESP32S2_DEV)
if (!((pin>=1 && pin<=20))) error(ANALOGREAD, PSTR("invalid pin"), number(pin));
#elif defined(ARDUINO_ESP32C3_DEV)
if (!((pin>=0 && pin<=5))) error(ANALOGREAD, PSTR("invalid pin"), number(pin));
#elif defined(ARDUINO_ESP32S3_DEV)
if (!(pin==0 || pin==2 || pin==3 || (pin>=4 && pin<=9 ))
error(TOUCHREAD, PSTR("invalid pin"), number(pin));
#endif
}
How can I do so that when I install a new version of ulisp I don’t have to write all these changes again.
Thanks