Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compat.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ void httpd_loop(int s);
void gpio_enable(int pin, int state);
void gpio_write(int pin, int value);
int gpio_read(int pin);
int sdk_system_adc_read();

// flash simulation in RAM
#define SPI_FLASH_RESULT_OK 0
Expand All @@ -128,6 +129,8 @@ void httpd_loop(int s);

#define flash_memory ((unsigned char*)(0x40200000 + FS_ADDRESS))

#include <stdbool.h>
#include <espressif/esp_system.h>
#include "esp_spiffs.h"
#include "spiffs.h"

Expand Down
6 changes: 6 additions & 0 deletions lisp.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,11 @@ PRIM dht(lisp pin) {
return cons(mkint(t), mkint(h));
}

PRIM adc() {
int v = sdk_system_adc_read();
return mkint(v);
}

// CONTROL INTERRUPTS:
// -------------------
// (interrupt PIN 0) : disable
Expand Down Expand Up @@ -3366,6 +3371,7 @@ lisp lisp_init() {
DEFPRIM(in, 1, in);
DEFPRIM(dht, 1, dht);
DEFPRIM(interrupt, 2, interrupt);
DEFPRIM(adc, 0, adc);

// system stuff
DEFPRIM(gc, -1, gc);
Expand Down
1 change: 1 addition & 0 deletions tlisp.ccc
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
void gpio_enable(int pin, int state) {}
void gpio_write(int pin, int value) {}
int gpio_read(int pin) { return 0; }
int sdk_system_adc_read() { return 777; }

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