New ESP-IDF project in v2/ that replaces the Pi and the UART bridge: - W5500 Ethernet, INMP441 beat/tempo detector (from esp32-eth), ESP-NOW master - LittleFS data store and a JSON API over the Pi's db/*.json collections, with /db import and export; web UI minified and gzipped at build time - Zone play/stop as 0x4C GROUP_CMD, preset push/send as CMD (binary v2 envelope, byte-identical to src/util/binary_envelope.py), sequencer and scenes, driver registration from the boot hello - Reliable bulk link: acks with retransmit, fragments, state-version digest and resync; beat frames sent twice with a lead so drivers fire together - Bench tooling: lossy-link mode, synthetic beats with echo measurement, USB and logic-analyzer latency scripts, and docs/BENCH_TEST.md Needs the matching led-driver changes (p2p branch) to receive the link and beat frames. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
26 lines
829 B
C
26 lines
829 B
C
#pragma once
|
|
|
|
#include <stddef.h>
|
|
#include "esp_err.h"
|
|
#include "freertos/FreeRTOS.h"
|
|
|
|
#define MIC_SAMPLE_RATE 16000
|
|
|
|
typedef struct {
|
|
float rms_dbfs; // RMS level over the last block, dB relative to full scale
|
|
float peak_dbfs; // Peak sample in the last block, dBFS
|
|
float spl_db; // Approximate dB SPL (INMP441: -26 dBFS @ 94 dB SPL)
|
|
} mic_level_t;
|
|
|
|
// Start the INMP441 I2S capture and the level-measuring task
|
|
esp_err_t mic_start(void);
|
|
|
|
// Latest level reading; returns -120 dBFS until the first block arrives
|
|
void mic_get_level(mic_level_t *out);
|
|
|
|
// Single-listener 16-bit mono PCM stream at MIC_SAMPLE_RATE.
|
|
// Returns ESP_ERR_INVALID_STATE if someone is already listening.
|
|
esp_err_t mic_stream_open(void);
|
|
size_t mic_stream_read(void *buf, size_t len, TickType_t timeout);
|
|
void mic_stream_close(void);
|