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

/*
 * This is a special header file for compatibility with the Arduino library part
 */


#ifndef ECXX_PLATFORM_NODEMCU_LIBACOMPAT_ARDUINO_H
#define ECXX_PLATFORM_NODEMCU_LIBACOMPAT_ARDUINO_H


//
// Include the eCxx header file
//
extern "C++" {
    #include "../FS.h"
}


//
// Redefine the program memory macros
//
#define PGM_P      eCxx::_PGMCharPointer
#define PGM_VOID_P eCxx::_PGMVoidPointer

#define F(X)    ( PGM_STR(X)   )
#define PSTR(X) ( PGM_STR(X).p )


//
// Define the "byte" data type
//
typedef eCxx::uint8_t byte;


//
// Bring out values from enumeration "SeekMode" from "FS.h"
//
using eCxx::NodeMCU::FileSystem::SeekSet;
using eCxx::NodeMCU::FileSystem::SeekCur;
using eCxx::NodeMCU::FileSystem::SeekEnd;


//
// Function prototypes
//

// "CRC32.cpp"
extern "C" eCxx::uint32_t crc32(const void* data, size_t length, eCxx::uint32_t crc = 0xFFFFFFFF);

// "Timing.cpp"
extern "C" void delay(unsigned long ms);
extern "C" unsigned long ICACHE_RAM_ATTR millis();

// "Schedule.cpp"
extern bool schedule_function(const std::function<void(void)>& fn);


#endif
