/*
 * 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_AVR_COMMON_HW_INFO_H
#define ECXX_PLATFORM_AVR_COMMON_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 uint32_t textSectionSize() noexcept;
        static uint32_t dataSectionSize() noexcept;
        static uint32_t bssSectionSize() noexcept;

        static uint32_t usedStackSize() noexcept;
        static uint32_t usedHeapSize() noexcept;

        static uint32_t freeRAMSize() noexcept;
        static uint32_t mallocMargin() noexcept;

        static uint8_t numberOfDigitalPins() noexcept;
        static uint8_t numberOfPWMPins() noexcept;
        static uint8_t numberOfADCPins() noexcept;
};


} // namespace eCxx


#endif
