Port of arduino-st4 (Kevin Ferrare) to ESP32/PlatformIO with: - FreeRTOS mutex protection at every layer (Pin, Axis, Pulse, Controller) - Hardware timer pulse guiding with ISR-safe deferred stop pattern - Backward-compatible serial protocol (57600 baud, #-terminated) - Extended commands: PULSE, POS?, SYNC, STATUS?, VERSION? - Optional WiFi/WebSocket control (gated by ST4_WIFI_ENABLED) - Dead-reckoning position tracker using esp_timer microsecond precision All 4 examples build clean against esp32dev target.
23 lines
461 B
C++
23 lines
461 B
C++
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
// ST4-ESP32: Single GPIO pin abstraction with configurable active logic
|
|
|
|
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
#include "ST4Types.h"
|
|
|
|
class ST4Pin {
|
|
int pin_;
|
|
ST4PinLogic logic_;
|
|
bool active_;
|
|
|
|
public:
|
|
ST4Pin();
|
|
|
|
void begin(int pin, ST4PinLogic logic = ST4PinLogic::ACTIVE_HIGH);
|
|
void activate();
|
|
void deactivate();
|
|
bool isActive() const;
|
|
int pin() const;
|
|
};
|