#ifndef __PLATFORM_CM4_SYSTEMTICK_H__
#define __PLATFORM_CM4_SYSTEMTICK_H__

#include "HwTimerInterface.h"
#include "platform/cm4/InterruptHandler.h"

namespace pinetime::platform::cm4
{
class SystemTick;
}
extern pinetime::platform::cm4::SystemTick system_tick;

namespace pinetime::platform::cm4
{
class SystemTick
    : public pinetime::platform::cm4::InterruptHandler
    , public pinetime::interfaces::HwTimerInterface
{
    public:
        SystemTick();

        static inline SystemTick & instance() { return system_tick; }

        void enable_timer() override;
        void disable_timer() override;
        uint64_t tick() override;

        void handle() override;

    private:
        uint64_t sys_tick;
};

}

#endif
