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


#ifndef INCLUDE_ECXX_PLATFORM_SPECIFIC_HW_INFO_H
#error "this file cannot be included directly"
#endif
#undef INCLUDE_ECXX_PLATFORM_SPECIFIC_HW_INFO_H


#ifndef ECXX_PLATFORM_NODEMCU_HW_INFO_H
#define ECXX_PLATFORM_NODEMCU_HW_INFO_H


namespace eCxx {


//
// A simple hardware information class
//
class HWInfo : public Uninstantiable  {
    public:
        static PGMCharPointer eCxxVersion() noexcept;
        static PGMCharPointer compilerVersion() noexcept;

        static PGMCharPointer deviceName() noexcept;

        static uint32_t chipSignature() noexcept;
        static void chipId(uint8_t (&id)[10]) noexcept;

        static uint32_t cpuFrequency() noexcept;
        static uint16_t cpuFrequency_kHz() noexcept;
        static uint8_t cpuFrequency_MHz() noexcept;

        static uint32_t totalRAMSize() noexcept;
        static uint32_t totalFlashSize() noexcept;
        static uint32_t totalEEPROMSize() noexcept;

        static uint32_t rawNVStorageSize() noexcept;
        static bool eepromIsEmulated() noexcept;

    public:
        static uint16_t iramSize() noexcept;
        static uint16_t icacheSize() noexcept;

        static uint32_t freeContStack() noexcept;
        static uint32_t freeHeapSize() noexcept;
        static uint16_t maxHeapFreeBlockSize() noexcept;
        static uint8_t percentHeapFragmentation() noexcept;

        static uint32_t userProgramSize() noexcept;
        static uint32_t freeUserProgramSpace() noexcept;

        static uint32_t flashChipId() noexcept;
        static uint32_t flashChipSpeed() noexcept;
        static uint8_t flashChipSpeed_MHz() noexcept;
        static PGMCharPointer flashChipMode() noexcept;
        static PGMCharPointer flashChipMap() noexcept;

        static uint8_t bootVersion() noexcept;
        static const char* sdkVersion() noexcept;
        static uint8_t time_tBitSize() noexcept;

        static uint8_t bootMode() noexcept;
        static PGMCharPointer resetReason() noexcept;

        static const uint8_t* macAddress() noexcept;
};


} // namespace eCxx


#endif
