File tree Expand file tree Collapse file tree 3 files changed +10
-0
lines changed Expand file tree Collapse file tree 3 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ void httpd_loop(int s);
111111 void gpio_enable (int pin , int state );
112112 void gpio_write (int pin , int value );
113113 int gpio_read (int pin );
114+ int sdk_system_adc_read ();
114115
115116 // flash simulation in RAM
116117 #define SPI_FLASH_RESULT_OK 0
@@ -128,6 +129,8 @@ void httpd_loop(int s);
128129
129130 #define flash_memory ((unsigned char*)(0x40200000 + FS_ADDRESS))
130131
132+ #include <stdbool.h>
133+ #include <espressif/esp_system.h>
131134 #include "esp_spiffs.h"
132135 #include "spiffs.h"
133136
Original file line number Diff line number Diff line change @@ -833,6 +833,11 @@ PRIM dht(lisp pin) {
833833 return cons (mkint (t ), mkint (h ));
834834}
835835
836+ PRIM adc () {
837+ int v = sdk_system_adc_read ();
838+ return mkint (v );
839+ }
840+
836841// CONTROL INTERRUPTS:
837842// -------------------
838843// (interrupt PIN 0) : disable
@@ -3366,6 +3371,7 @@ lisp lisp_init() {
33663371 DEFPRIM (in , 1 , in );
33673372 DEFPRIM (dht , 1 , dht );
33683373 DEFPRIM (interrupt , 2 , interrupt );
3374+ DEFPRIM (adc , 0 , adc );
33693375
33703376 // system stuff
33713377 DEFPRIM (gc , -1 , gc );
Original file line number Diff line number Diff line change 2424void gpio_enable(int pin, int state) {}
2525void gpio_write(int pin, int value) {}
2626int gpio_read(int pin) { return 0; }
27+ int sdk_system_adc_read() { return 777; }
2728
2829void interrupt_init (int pin, int changeType) {}
2930int getInterruptCount(int pin, int mode) { return -1; }
You can’t perform that action at this time.
0 commit comments