/*
 * Copyright (C) 2020-2021 Aloysius Indrayanto
 *
 * This file is part of the eCxx library, see LICENSE file for the license details.
 */


#ifndef ECXX_PLATFORM_COMMON_PIN_DDX_H
#define ECXX_PLATFORM_COMMON_PIN_DDX_H


#ifdef ECXX_BUILDING_ECXX_LIBRARY
    #include <eCxx/CTL/HaveMemberCheck.h>
#endif


//
// Include the platform-specific's implementation
//
#define INCLUDE_ECXX_PLATFORM_SPECIFIC_PIN_DDX_H

// AVR
#if defined(__AVR_ARCH_X__)
    #include "../AVRX/PinDDX.h"
#elif defined(__AVR_ARCH__)
    #include "../AVR/PinDDX.h"
#endif

// NodeMCU-ESP8266
#ifdef __XTENSA__
    #include "../NodeMCU/PinDDX.h"
#endif

// Dummy (for testing the eCxx library in the host PC)
#ifdef INCLUDE_ECXX_PLATFORM_SPECIFIC_PIN_DDX_H
    #include "../Dummy/PinDDX.h"
#endif


//
// Check if the platform-specific's implementation provides the necessary member types/constants/variables/functions/etc.
//
#ifdef ECXX_BUILDING_ECXX_LIBRARY

namespace eCxx {

    namespace internal_uart_check {

        // Member constants/variables/functions
        ECXX_CHECK_HAVE_MEMBER(PinDDX<0>, pinModeOutput);
        ECXX_CHECK_HAVE_MEMBER(PinDDX<0>, digitalWrite);

        ECXX_CHECK_HAVE_MEMBER(PinDDX<0>, pinModeInput);
        ECXX_CHECK_HAVE_MEMBER(PinDDX<0>, digitalRead);

    } // namespace internal

} // namespace eCxx

#endif


#endif
