I want to use the timer in my microcontroller as tick generator of the chrono class. imagine that I have function that gets the tick from timer register in the MCU and I call it get_tcik() and this register is 32 bit unsigned integer which increments each 1 microsecond. Now to use it with chrono I've created a class like this:
class clock
{
public:
static std::chrono::time_point<clock, std::chrono::duration<std::uint32_t, std::ratio<1, 1000000> now() {
return std::chrono::time_point<clock, std::chrono::duration<std::uint32_t, std::ratio<1, 1000000> {std::chrono::duration<uint32_t, std::ratio<1, 1000000>> { get_tick() }};
}
};
And it doesn't work!