move MicroPython and dashboards -> tutorials

This commit is contained in:
Sergio R. Caprile committed 2025-02-26 11:31:01 -03:00
1 parent 1078ba0a92
commit b3f5d11275
97 files changed
+22 -20

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
THISDIR = $(realpath $(CURDIR))
ROOTDIR = $(realpath $(CURDIR)/../../..)
PORT ?= /dev/ttyUSB0
DOCKER ?= docker run --rm $(DA) -v $(ROOTDIR):$(ROOTDIR) -w $(THISDIR) espressif/idf:v5.0.4
# Note that the esp32 port needs the extra .. for relative paths due to the location of its main CMakeLists.txt file
CMD ?= bash -c '$(MAKE) -C micropython/ports/esp32 submodules && $(MAKE) -C micropython/ports/esp32 USER_C_MODULES=../../../../mongoose/micropython.cmake'
all: example
example:
true
build: micropython
$(DOCKER) $(CMD)
micropython:
$(DOCKER) git clone --depth 1 -b v1.22.2 https://github.com/micropython/micropython.git
clean:
test -d micropython && $(DOCKER) rm -rf micropython || true
flash:
flash: DA = --device $(PORT)
flash: CMD = bash -c '$(MAKE) -C micropython/ports/esp32 erase deploy'
flash: build
+21
View File
@@ -0,0 +1,21 @@
# Mongoose as a MicroPython user module on the ESP32
The most basic usage is:
```python
import network
import mongoose
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
sta_if.connect("<SSID>", "<PASSWORD>")
while not sta_if.isconnected():
pass
mongoose.init()
while True:
mongoose.poll(1000)
```
[Please check the Linux example for more information and useful links](../README.md)
@@ -0,0 +1,28 @@
// Copyright (c) 2022 Cesanta Software Limited
// All rights reserved
#include "mongoose.h"
static void t_fn(void *arg) { // Tick periodically
MG_INFO(("tick"));
(void) arg;
}
static void fn(struct mg_connection *c, int ev, void *ev_data) {
if (ev == MG_EV_HTTP_MSG) mg_http_reply(c, 200, "", "hi\n");
(void) ev_data;
}
static struct mg_mgr mgr;
void mgmp_init(void) {
mg_mgr_init(&mgr); // Mongoose event manager
mg_log_set(MG_LL_DEBUG); // Set log level
mg_timer_add(&mgr, 1000, MG_TIMER_REPEAT, t_fn, &mgr);
mg_http_listen(&mgr, "http://0.0.0.0:80", fn, &mgr);
}
void mgmp_poll(int t) {
mg_mgr_poll(&mgr, t);
}
@@ -0,0 +1 @@
../../mongoose/micropython.cmake
+1
View File
@@ -0,0 +1 @@
../../mongoose/micropython.mk
+1
View File
@@ -0,0 +1 @@
../../mongoose/module.c
+1
View File
@@ -0,0 +1 @@
../../../../mongoose.c
+1
View File
@@ -0,0 +1 @@
../../../../mongoose.h
@@ -0,0 +1 @@
#define MG_ARCH MG_ARCH_ESP32