Skip to content

Commit 4bee172

Browse files
committed
Merge branch 'master' of https://github.com/yesco/esp-lisp
2 parents 77e74d0 + be1c249 commit 4bee172

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

compat.h

100644100755
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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

lisp.c

100644100755
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff 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
@@ -3365,6 +3370,7 @@ lisp lisp_init() {
33653370
DEFPRIM(in, 1, in);
33663371
DEFPRIM(dht, 1, dht);
33673372
DEFPRIM(interrupt, 2, interrupt);
3373+
DEFPRIM(adc, 0, adc);
33683374

33693375
// system stuff
33703376
DEFPRIM(gc, -1, gc);

tlisp.ccc

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
void gpio_enable(int pin, int state) {}
2525
void gpio_write(int pin, int value) {}
2626
int gpio_read(int pin) { return 0; }
27+
int sdk_system_adc_read() { return 777; }
2728

2829
void interrupt_init (int pin, int changeType) {}
2930
int getInterruptCount(int pin, int mode) { return -1; }

0 commit comments

Comments
 (0)