Split the monolithic IbusEsp32 class into composable layers: - KLineTransport: UART, GPIO ISR, ring buffers, idle detection - IbusHandler: BMW I/K-Bus FSM, source filtering, packet callback - IbusEsp32: thin facade preserving the original API Library renamed from IbusEsp32 to AutoWire. Existing sniffer sketch (main.cpp) requires zero changes. All 3 ESP32 environments build cleanly (esp32dev, esp32-c3, esp32-s3).
26 lines
498 B
C++
26 lines
498 B
C++
#pragma once
|
|
// Ring buffer for async I/K-Bus message handling
|
|
// Based on muki01/I-K_Bus RingBuffer (MIT license)
|
|
|
|
#include <Arduino.h>
|
|
|
|
class RingBuffer {
|
|
public:
|
|
RingBuffer(int size);
|
|
~RingBuffer();
|
|
|
|
int available();
|
|
int capacity(); // usable slots (size - 1, ring buffer wastes one)
|
|
int peek();
|
|
int peek(int n);
|
|
void remove(int n);
|
|
int read();
|
|
byte write(int c);
|
|
|
|
private:
|
|
int _size;
|
|
unsigned int _head;
|
|
unsigned int _tail;
|
|
byte* _buf;
|
|
};
|