File tree 3 files changed +10
-0
lines changed 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);
111
111
void gpio_enable (int pin , int state );
112
112
void gpio_write (int pin , int value );
113
113
int gpio_read (int pin );
114
+ int sdk_system_adc_read ();
114
115
115
116
// flash simulation in RAM
116
117
#define SPI_FLASH_RESULT_OK 0
@@ -128,6 +129,8 @@ void httpd_loop(int s);
128
129
129
130
#define flash_memory ((unsigned char*)(0x40200000 + FS_ADDRESS))
130
131
132
+ #include <stdbool.h>
133
+ #include <espressif/esp_system.h>
131
134
#include "esp_spiffs.h"
132
135
#include "spiffs.h"
133
136
Original file line number Diff line number Diff line change @@ -833,6 +833,11 @@ PRIM dht(lisp pin) {
833
833
return cons (mkint (t ), mkint (h ));
834
834
}
835
835
836
+ PRIM adc () {
837
+ int v = sdk_system_adc_read ();
838
+ return mkint (v );
839
+ }
840
+
836
841
// CONTROL INTERRUPTS:
837
842
// -------------------
838
843
// (interrupt PIN 0) : disable
@@ -3365,6 +3370,7 @@ lisp lisp_init() {
3365
3370
DEFPRIM (in , 1 , in );
3366
3371
DEFPRIM (dht , 1 , dht );
3367
3372
DEFPRIM (interrupt , 2 , interrupt );
3373
+ DEFPRIM (adc , 0 , adc );
3368
3374
3369
3375
// system stuff
3370
3376
DEFPRIM (gc , -1 , gc );
Original file line number Diff line number Diff line change 24
24
void gpio_enable(int pin, int state) {}
25
25
void gpio_write(int pin, int value) {}
26
26
int gpio_read(int pin) { return 0; }
27
+ int sdk_system_adc_read() { return 777; }
27
28
28
29
void interrupt_init (int pin, int changeType) {}
29
30
int getInterruptCount(int pin, int mode) { return -1; }
You can’t perform that action at this time.
0 commit comments