#pragma once

// IWYU pragma: private

/// @file platforms/shared/pin_noop.hpp
/// Pin implementation for non-Arduino builds (WASM, host tests without stub GPIO).
///
/// All functions are no-ops. Stub (FL_IS_STUB) builds use
/// platforms/stub/pin_stub.hpp instead, which routes through fl::stub::setPinState.
///
/// Functions are placed in the platform namespace and will be wrapped by non-inline
/// functions in fl/pin.cpp.

#include "platforms/is_platform.h"

namespace fl {
namespace platforms {

// ============================================================================
// Pin mode control
// ============================================================================

inline void pinMode(int /*pin*/, PinMode /*mode*/) {
    // No-op: Host builds don't have physical pins
}

// ============================================================================
// Digital I/O
// ============================================================================

inline void digitalWrite(int /*pin*/, PinValue /*val*/) {
    // No-op: Host builds don't have physical pins
}

inline PinValue digitalRead(int /*pin*/) {
    return PinValue::Low;  // Always return LOW
}

// ============================================================================
// Analog I/O
// ============================================================================

inline u16 analogRead(int /*pin*/) {
    // No-op: Host builds don't have physical pins
    return 0;  // Always return 0
}

inline void analogWrite(int /*pin*/, u16 /*val*/) {
    // No-op: Host builds don't have physical pins
}

inline void setPwm16(int /*pin*/, u16 /*val*/) {
    // No-op: Host builds don't have physical pins
}

inline void setAdcRange(AdcRange /*range*/) {
    // No-op: Host builds don't have physical pins
}

// ============================================================================
// PWM Frequency Control
// ============================================================================

inline bool needsPwmIsrFallback(int /*pin*/, u32 /*frequency_hz*/) {
    return true;
}

inline int setPwmFrequencyNative(int /*pin*/, u32 /*frequency_hz*/) {
    return -4;
}

inline u32 getPwmFrequencyNative(int /*pin*/) {
    return 0;
}

}  // namespace platforms
}  // namespace fl
