Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

M1 App SDK

Build external apps for the Monstatek M1. Apps are relocatable ARM ELF files (.m1app) loaded from the SD card and run as FreeRTOS tasks on the M1's Cortex-M33, calling firmware functions resolved at load time via a symbol table.

Runs on app-loader firmware such as M1-firmware-connected.

What's in this SDK

  • include/m1app.h — the full app API: display (u8g2), input, timing, memory, audio, LEDs, GPIO/I2C/SPI, IR, NFC/RFID/Sub-GHz, crypto, file I/O, Flipper file parsers, and a new HTTP client (see below).
  • include/m1app_conf.h — header-only SD config parser (m1conf_load/get/ get_n/split) so apps are configured from .conf files, no recompile.
  • examples/ — hello world, game template, coin flip, flappy bird, etc.
  • apps/ — four homelab/device-integration apps (below).

HTTP client (new)

Apps can call LAN/cloud device APIs over WiFi. The ESP32-C6 (ESP-AT firmware) does the TCP/TLS; the firmware just formats AT+HTTPCLIENT.

int m1_http_get(const char *url, char *resp, int resp_size);
int m1_http_post_json(const char *url, const char *json_body, char *resp, int resp_size);
int m1_http_request(int method, int content_type, const char *url,
                    const char *headers /* e.g. "Authorization: Bearer …" */,
                    const char *body, char *resp, int resp_size);

Returns response-body bytes (≥0) or a negative M1APP_HTTP_ERR_*. Requires the device to be on WiFi (Main Menu → WiFi → Config).

Bundled apps (apps/)

App What it does Config file
ha_remote Toggle Home Assistant entities (authenticated) ha.conf
fleet_status Up/down reachability board for your LAN hosts fleet.conf
webhook_buttons Fire configurable GET/POST webhooks hooks.conf
device_status Poll authenticated JSON endpoints, show a value each status.conf

Each app ships a *.conf.example — copy it to 0:/apps/<name>.conf on the SD card and edit it (URLs, tokens, entity IDs).

Build

sudo apt install gcc-arm-none-eabi        # or brew install arm-none-eabi-gcc
make APP=apps/ha_remote                    # -> apps/ha_remote/ha_remote.m1app
make APP=examples/hello_world              # build an example

Deploy

  1. Flash app-loader firmware (M1-firmware-connected) + ESP-AT (with HTTP support) to the ESP32-C6; connect WiFi on the device.
  2. Copy *.m1app and the edited *.conf to 0:/apps/ on the SD card.
  3. On the M1: Main Menu → Apps → pick your app.

Pre-built .m1app files for the four apps are attached to the Releases.

Writing your own app

#include "m1app.h"
M1_APP_MANIFEST("My App", 512);            /* name, stack in 32-bit words */

int32_t app_main(void *context) {
    u8g2_t *u8g2 = m1app_get_u8g2();
    while (1) {
        m1app_display_begin();
        do { u8g2_SetFont(u8g2, u8g2_font_6x10_tr);
             u8g2_DrawStr(u8g2, 10, 30, "Hello!"); } while (m1app_display_flush());
        if (game_poll_button(100) == M1APP_BTN_BACK) break;
    }
    return 0;
}

See include/m1app.h for the complete API and the list of available fonts.

About

SDK for Monstatek M1 .m1app apps — HTTP client API + config helper + 4 homelab apps (Home Assistant remote, fleet status, webhooks, device status)

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages