|
1 |
| -/* uLisp ESP Version 2.6 - www.ulisp.com |
2 |
| - David Johnson-Davies - www.technoblogy.com - 9th April 2019 |
| 1 | +/* uLisp ESP Version 2.6a - www.ulisp.com |
| 2 | + David Johnson-Davies - www.technoblogy.com - 19th April 2019 |
3 | 3 |
|
4 | 4 | Licensed under the MIT license: https://opensource.org/licenses/MIT
|
5 | 5 | */
|
@@ -2895,13 +2895,16 @@ object *fn_cls (object *args, object *env) {
|
2895 | 2895 | object *fn_pinmode (object *args, object *env) {
|
2896 | 2896 | (void) env;
|
2897 | 2897 | int pin = integer(first(args));
|
| 2898 | + int pm = INPUT; |
2898 | 2899 | object *mode = second(args);
|
2899 |
| - if ((integerp(mode) && mode->integer == 1) || mode != nil) pinMode(pin, OUTPUT); |
2900 |
| - else if (integerp(mode) && mode->integer == 2) pinMode(pin, INPUT_PULLUP); |
2901 |
| - #if defined(INPUT_PULLDOWN) |
2902 |
| - else if (integerp(mode) && mode->integer == 4) pinMode(pin, INPUT_PULLDOWN); |
2903 |
| - #endif |
2904 |
| - else pinMode(pin, INPUT); |
| 2900 | + if (integerp(mode)) { |
| 2901 | + int nmode = integer(mode); |
| 2902 | + if (nmode == 1) pm = OUTPUT; else if (nmode == 2) pm = INPUT_PULLUP; |
| 2903 | + #if defined(INPUT_PULLDOWN) |
| 2904 | + else if (nmode == 4) pm = INPUT_PULLDOWN; |
| 2905 | + #endif |
| 2906 | + } else if (mode != nil) pm = OUTPUT; |
| 2907 | + pinMode(pin, pm); |
2905 | 2908 | return nil;
|
2906 | 2909 | }
|
2907 | 2910 |
|
@@ -3043,9 +3046,9 @@ void superprint (object *form, int lm, pfun_t pfun) {
|
3043 | 3046 | else supersub(form, lm + PPINDENT, 1, pfun);
|
3044 | 3047 | }
|
3045 | 3048 |
|
3046 |
| -const int ppspecials = 15; |
| 3049 | +const int ppspecials = 16; |
3047 | 3050 | const char ppspecial[ppspecials] PROGMEM =
|
3048 |
| - { DOTIMES, DOLIST, IF, SETQ, TEE, LET, LETSTAR, LAMBDA, WHEN, UNLESS, WITHI2C, WITHSERIAL, WITHSPI, WITHSDCARD, WITHCLIENT }; |
| 3051 | + { DOTIMES, DOLIST, IF, SETQ, TEE, LET, LETSTAR, LAMBDA, WHEN, UNLESS, WITHI2C, WITHSERIAL, WITHSPI, WITHSDCARD, FORMILLIS, WITHCLIENT }; |
3049 | 3052 |
|
3050 | 3053 | void supersub (object *form, int lm, int super, pfun_t pfun) {
|
3051 | 3054 | int special = 0, separate = 1;
|
@@ -3673,7 +3676,7 @@ object *eval (object *form, object *env) {
|
3673 | 3676 | object *function = car(form);
|
3674 | 3677 | object *args = cdr(form);
|
3675 | 3678 |
|
3676 |
| - if (function == NULL) error(PSTR("'nil' is an illegal function")); |
| 3679 | + if (function == NULL) error3(NIL, PSTR("is an illegal function")); |
3677 | 3680 | if (!listp(args)) error(PSTR("Can't evaluate a dotted pair"));
|
3678 | 3681 |
|
3679 | 3682 | // List starts with a symbol?
|
|
0 commit comments