Version 2.6a - 19th April 2019

Fixes #11
This commit is contained in:
David Johnson-Davies 2019-04-19 13:32:27 +01:00 committed by GitHub
parent 2b4f30c05f
commit 3710e8a7da
1 changed files with 14 additions and 11 deletions

View File

@ -1,5 +1,5 @@
/* uLisp ARM 2.6 - www.ulisp.com /* uLisp ARM 2.6a - www.ulisp.com
David Johnson-Davies - www.technoblogy.com - 9th April 2019 David Johnson-Davies - www.technoblogy.com - 19th April 2019
Licensed under the MIT license: https://opensource.org/licenses/MIT Licensed under the MIT license: https://opensource.org/licenses/MIT
*/ */
@ -3049,13 +3049,16 @@ object *fn_cls (object *args, object *env) {
object *fn_pinmode (object *args, object *env) { object *fn_pinmode (object *args, object *env) {
(void) env; (void) env;
int pin = integer(first(args)); int pin = integer(first(args));
int pm = INPUT;
object *mode = second(args); object *mode = second(args);
if ((integerp(mode) && mode->integer == 1) || mode != nil) pinMode(pin, OUTPUT); if (integerp(mode)) {
else if (integerp(mode) && mode->integer == 2) pinMode(pin, INPUT_PULLUP); int nmode = integer(mode);
#if defined(INPUT_PULLDOWN) if (nmode == 1) pm = OUTPUT; else if (nmode == 2) pm = INPUT_PULLUP;
else if (integerp(mode) && mode->integer == 4) pinMode(pin, INPUT_PULLDOWN); #if defined(INPUT_PULLDOWN)
#endif else if (nmode == 4) pm = INPUT_PULLDOWN;
else pinMode(pin, INPUT); #endif
} else if (mode != nil) pm = OUTPUT;
pinMode(pin, pm);
return nil; return nil;
} }
@ -3197,9 +3200,9 @@ void superprint (object *form, int lm, pfun_t pfun) {
else supersub(form, lm + PPINDENT, 1, pfun); else supersub(form, lm + PPINDENT, 1, pfun);
} }
const int ppspecials = 14; const int ppspecials = 15;
const char ppspecial[ppspecials] PROGMEM = const char ppspecial[ppspecials] PROGMEM =
{ DOTIMES, DOLIST, IF, SETQ, TEE, LET, LETSTAR, LAMBDA, WHEN, UNLESS, WITHI2C, WITHSERIAL, WITHSPI, WITHSDCARD }; { DOTIMES, DOLIST, IF, SETQ, TEE, LET, LETSTAR, LAMBDA, WHEN, UNLESS, WITHI2C, WITHSERIAL, WITHSPI, WITHSDCARD, FORMILLIS };
void supersub (object *form, int lm, int super, pfun_t pfun) { void supersub (object *form, int lm, int super, pfun_t pfun) {
int special = 0, separate = 1; int special = 0, separate = 1;
@ -3753,7 +3756,7 @@ object *eval (object *form, object *env) {
object *function = car(form); object *function = car(form);
object *args = cdr(form); object *args = cdr(form);
if (function == NULL) error(PSTR("'nil' is an illegal function")); if (function == NULL) error3(NIL, PSTR("is an illegal function"));
if (!listp(args)) error(PSTR("Can't evaluate a dotted pair")); if (!listp(args)) error(PSTR("Can't evaluate a dotted pair"));
// List starts with a symbol? // List starts with a symbol?