Skip to content

Commit 29c3a73

Browse files
committed
Initial esp-lisp as it was 2015-09-22 19:19
- initial datatypes: string, atom, cons, int, prim - primitive function apply - slow but generic - lisp reader - princ writer, terpri - a version of lisp eval that only calls a primitive function - some tests for reader/writer and primitive call - ./run to compile and run on desktop and to compile for esp, run make flash to flush - ./mcu to connect to chip
1 parent 8c84183 commit 29c3a73

File tree

8 files changed

+517
-0
lines changed

8 files changed

+517
-0
lines changed

Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Simple makefile for eps-lisp
2+
PROGRAM=*.c
3+
include ../esp-open-rtos/common.mk
4+

add-path

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
source ../path-add-esp

esplisp.c

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/* 2015-09-22 (C) Jonas S Karlsson, [email protected] */
2+
/* "driver" for esp-open-rtos put in examples/lisp */
3+
4+
#include "espressif/esp_common.h"
5+
#include "espressif/sdk_private.h"
6+
#include "FreeRTOS.h"
7+
#include "task.h"
8+
#include "queue.h"
9+
10+
#include <string.h>
11+
12+
#include "lisp.h"
13+
14+
void task1(void *pvParameters)
15+
{
16+
xQueueHandle *queue = (xQueueHandle *)pvParameters;
17+
printf("Hello from task1!\r\n");
18+
uint32_t count = 0;
19+
while(1) {
20+
vTaskDelay(300); // 3s
21+
22+
unsigned int mem = xPortGetFreeHeapSize();
23+
printf("free=%u\r\n", mem);
24+
lisptest();
25+
printf("free=%u USED=%u\r\n", xPortGetFreeHeapSize(), (unsigned int)(mem-xPortGetFreeHeapSize()));
26+
27+
xQueueSend(*queue, &count, 0);
28+
count++;
29+
}
30+
}
31+
32+
void task2(void *pvParameters)
33+
{
34+
printf("Hello from task 2!\r\n");
35+
xQueueHandle *queue = (xQueueHandle *)pvParameters;
36+
while(1) {
37+
uint32_t count;
38+
if(xQueueReceive(*queue, &count, 1000)) {
39+
//printf("Got %u\n", count);
40+
putchar('.');
41+
} else {
42+
printf("No msg :(\n");
43+
}
44+
}
45+
}
46+
47+
static xQueueHandle mainqueue;
48+
49+
void user_init(void)
50+
{
51+
sdk_uart_div_modify(0, UART_CLK_FREQ / 115200);
52+
printf("SDK version:%s\n", sdk_system_get_sdk_version());
53+
54+
lispinit();
55+
56+
mainqueue = xQueueCreate(10, sizeof(uint32_t));
57+
xTaskCreate(task1, (signed char *)"tsk1", 256, &mainqueue, 2, NULL);
58+
xTaskCreate(task2, (signed char *)"tsk2", 256, &mainqueue, 2, NULL);
59+
}

0 commit comments

Comments
 (0)