Longan Nano
Longan Nano Demo
|
Go to the documentation of this file.
37 #ifndef LONGAN_NANO_CHRONO_H_
38 #define LONGAN_NANO_CHRONO_H_
44 #include <gd32vf103.h>
180 static bool delay(
Unit unit,
unsigned int delay_tmp );
369 if ((Config::PEDANTIC_CHECKS ==
true) && (start_tmp == Config::SYSTICK_INVALID))
371 return Config::TIME_INVALID;
379 uint64_t stop_tmp = get_timer_value();
414 if ((Config::PEDANTIC_CHECKS ==
true) && (start_tmp == Config::SYSTICK_INVALID))
419 uint64_t accumulator_tmp;
440 uint64_t stop_tmp = get_timer_value();
444 accumulator_tmp += stop_tmp -start_tmp;
476 if ((Config::PEDANTIC_CHECKS ==
true) && (start_tmp == Config::SYSTICK_INVALID))
481 uint64_t accumulator_tmp;
502 uint64_t stop_tmp = get_timer_value();
506 accumulator_tmp += stop_tmp -start_tmp;
542 if ((start_tmp == Config::SYSTICK_INVALID) || (stop_tmp == Config::SYSTICK_INVALID))
544 return Config::TIME_INVALID;
549 return Config::TIME_INVALID;
577 return Config::TIME_INVALID;
608 return SystemCoreClock /Config::SYSTICK_PRE;
631 uint64_t systick_tmp;
633 uint64_t systick_stop;
648 systick_stop = get_timer_value();
650 systick_stop += numticks *delay_tmp;
657 systick_tmp = get_timer_value();
659 while( systick_tmp < systick_stop );
694 case Unit::milliseconds:
696 return SystemCoreClock /1000 /Config::SYSTICK_PRE;
699 case Unit::microseconds:
701 return SystemCoreClock /1000000 /Config::SYSTICK_PRE;
737 if ((Config::PEDANTIC_CHECKS ==
true) && (
start >
stop))
740 return Config::TIME_INVALID;
750 if ((Config::PEDANTIC_CHECKS ==
true) && (numticks_time_unit == 0))
757 deltat /= numticks_time_unit;
759 int32_t ret = deltat;
786 if ((Config::PEDANTIC_CHECKS ==
true) && (accumulator == Config::SYSTICK_INVALID))
798 if ((Config::PEDANTIC_CHECKS ==
true) && (numticks_time_unit == 0))
803 accumulator /= numticks_time_unit;
805 int32_t ret = accumulator;
821 #warning "Multiple inclusion of hader file LONGAN_NANO_CHRONO_H_"
@ SYSTICK_INVALID
Definition: longan_nano_chrono.hpp:123
~Chrono(void)
Empty Destructor.
Definition: longan_nano_chrono.hpp:254
@ PEDANTIC_CHECKS
Definition: longan_nano_chrono.hpp:122
@ microseconds
Definition: longan_nano_chrono.hpp:127
_Config
Configurations of the SysTick.
Definition: longan_nano_chrono.hpp:117
enum Longan_nano::Chrono::_Unit Unit
Possible time units. Same names as std::Chrono.
bool accumulate(void)
public method accumulate | void |
Definition: longan_nano_chrono.hpp:405
void stop(void)
public method stop | void
Definition: longan_nano_chrono.hpp:331
Deals with busy delays, elapsed time and accumulated time.
Definition: longan_nano_chrono.hpp:106
int32_t compute_elapsed(uint64_t start, uint64_t stop, Unit unit)
private method compute_elapsed | uint64_t | uint64_t | Unit |
Definition: longan_nano_chrono.hpp:730
int32_t get_elapsed(Unit unit)
public getter get_elapsed | Unit |
Definition: longan_nano_chrono.hpp:527
int32_t get_accumulator(Unit unit)
public getter get_accumulator | Unit |
Definition: longan_nano_chrono.hpp:569
@ milliseconds
Definition: longan_nano_chrono.hpp:126
uint64_t g_systick_start
Definition: longan_nano_chrono.hpp:206
@ SYSTICK_PRE
Definition: longan_nano_chrono.hpp:124
void start(void)
public method start | void
Definition: longan_nano_chrono.hpp:278
Chrono(void)
Empty Constructor Chrono | void.
Definition: longan_nano_chrono.hpp:226
static uint32_t compute_tick_per_time_unit(Unit unit)
private method compute_tick_per_time_unit | Unit |
Definition: longan_nano_chrono.hpp:684
bool g_f_accumulator_mode
Definition: longan_nano_chrono.hpp:204
void restart(void)
public method start | void
Definition: longan_nano_chrono.hpp:303
static unsigned int get_systick_freq(void)
public static method get_systick_freq | void
Definition: longan_nano_chrono.hpp:602
int32_t compute_accumulator(uint64_t accumulator, Unit unit)
private method compute_accumulator | uint64_t | Unit |
Definition: longan_nano_chrono.hpp:779
_Unit
Possible time units. Same names as std::Chrono.
Definition: longan_nano_chrono.hpp:125
@ TIME_INVALID
Definition: longan_nano_chrono.hpp:125
uint64_t g_systick_stop
Definition: longan_nano_chrono.hpp:208
enum Longan_nano::Chrono::_Config Config
Configurations of the SysTick.
static bool delay(Unit unit, unsigned int delay_tmp)
public static method delay | Unit | unsigned int |
Definition: longan_nano_chrono.hpp:624