interplane.Get Omega
Read in your language

interplane-mv

INTERPLANE: open interoperability protocol between AI models and agent runtimes. Models express intent. Runtimes retain authority.

Brought by drakestapleton

branch main Branches Tags History

interplane-mv / docs / external / nightdriver / 666 / harness / stubs / legacy / globals.h

47 lines · 2100 bytes Raw Blame History
1// Host stub for the platform layer. Written for this harness; not NightDriverStrip code.
2// Provides only what src/socketserver.cpp and include/socketserver.h need from "globals.h".
3#pragma once
4#include <cstdint>
5#include <cstddef>
6#include <cstdio>
7#include <cstdarg>
8#include <memory>
9#include <mutex>
10#include <unistd.h>
11
12#ifndef ENABLE_AUDIO
13#define ENABLE_AUDIO 0
14#endif
15#define INCOMING_WIFI_ENABLED 1
16#define USE_PSRAM 0
17#ifndef NUM_LEDS
18#define NUM_LEDS 144
19#endif
20#define NUM_BANDS 16
21#define FLASH_VERSION 1
22#define WIFI_COMMAND_PIXELDATA64 3
23#define WIFI_COMMAND_PEAKDATA 4
24
25struct CRGB { uint8_t r, g, b; };
26
27template <typename T> using allocated_unique_ptr = std::unique_ptr<T>;
28template <typename T> std::unique_ptr<T> make_unique_psram(size_t n) { return std::unique_ptr<T>(new typename std::remove_extent<T>::type[n]()); }
29template <typename T> std::unique_ptr<T> make_unique_internal(size_t n) { return make_unique_psram<T>(n); }
30
31extern int g_debugLevel; // 0 quiet, 1 errors, 2 verbose
32void host_log(int level, const char* tag, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
33#define debugV(...) host_log(2, "V", __VA_ARGS__)
34#define debugI(...) host_log(1, "I", __VA_ARGS__)
35#define debugW(...) host_log(1, "W", __VA_ARGS__)
36#define debugE(...) host_log(1, "E", __VA_ARGS__)
37inline void delay(unsigned ms) { usleep(ms * 1000u); }
38struct HostWiFi { int RSSI() const { return -50; } };
39extern HostWiFi WiFi;
40#include <arpa/inet.h>
41#include <cstring>
42// Little-endian host (and the ESP32) read helpers; stand-ins for the ones in the real globals.h.
43inline uint16_t WORDFromMemory(const uint8_t* p) { uint16_t v; std::memcpy(&v, p, sizeof v); return v; }
44inline uint32_t DWORDFromMemory(const uint8_t* p) { uint32_t v; std::memcpy(&v, p, sizeof v); return v; }
45inline uint64_t ULONGFromMemory(const uint8_t* p) { uint64_t v; std::memcpy(&v, p, sizeof v); return v; }
46// Allocator stand-in: memory comes from new[] so unique_ptr<uint8_t[]>::reset(ptr) can delete[] it.
47template <typename T> struct psram_allocator { T* allocate(size_t n) { return new T[n](); } };