/*
 * 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_TWISLAVE_H
#define ECXX_PLATFORM_COMMON_TWISLAVE_H


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

#include <eCxx/CTL/BasicOutputWriter.h>
#include <eCxx/CTL/Function.h>
#include <eCxx/CTL/RingBuffer.h>


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

// AVR
#ifdef __AVR_ARCH__
    #include "../AVRCommon/TWISlave.h"
#endif

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

// Dummy (for testing the eCxx library in the host PC)
#ifdef INCLUDE_ECXX_PLATFORM_SPECIFIC_TWISLAVE_H
    #include "../Dummy/TWISlave.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_twislave_check {

        // Member constants/variables/functions
        ECXX_CHECK_HAVE_MEMBER(TWISlave, TWIResultCode);

        ECXX_CHECK_HAVE_MEMBER(TWISlave, begin);
        ECXX_CHECK_HAVE_MEMBER(TWISlave, end);

        ECXX_CHECK_HAVE_MEMBER(TWISlave, canRead);
        ECXX_CHECK_HAVE_MEMBER(TWISlave, read);
        ECXX_CHECK_HAVE_MEMBER(TWISlave, peek);

        ECXX_CHECK_HAVE_MEMBER(TWISlave, write);

    } // namespace internal

} // namespace eCxx

#endif


#endif
