Longan Nano
Longan Nano Demo
longan_nano_chrono.hpp
Go to the documentation of this file.
1 /**********************************************************************************
2 BSD 3-Clause License
3 
4 Copyright (c) 2020, Orso Eric
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice, this
11  list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its
18  contributors may be used to endorse or promote products derived from
19  this software without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 **********************************************************************************/
32 
33 /**********************************************************************************
34 ** ENVIROMENT VARIABILE
35 **********************************************************************************/
36 
37 #ifndef LONGAN_NANO_CHRONO_H_
38  #define LONGAN_NANO_CHRONO_H_
39 
40 /**********************************************************************************
41 ** GLOBAL INCLUDES
42 **********************************************************************************/
43 
44 #include <gd32vf103.h>
45 
46 /**********************************************************************************
47 ** DEFINES
48 **********************************************************************************/
49 
50 /**********************************************************************************
51 ** MACROS
52 **********************************************************************************/
53 
54 /**********************************************************************************
55 ** NAMESPACE
56 **********************************************************************************/
57 
59 namespace Longan_nano
60 {
61 
62 /**********************************************************************************
63 ** TYPEDEFS
64 **********************************************************************************/
65 
66 /**********************************************************************************
67 ** PROTOTYPE: STRUCTURES
68 **********************************************************************************/
69 
70 /**********************************************************************************
71 ** PROTOTYPE: GLOBAL VARIABILES
72 **********************************************************************************/
73 
74 /**********************************************************************************
75 ** PROTOTYPE: CLASS
76 **********************************************************************************/
77 
78 /************************************************************************************/
80 /************************************************************************************/
103 /************************************************************************************/
104 
105 class Chrono
106 {
107  //Visible to all
108  public:
109  /*********************************************************************************************************************************************************
110  **********************************************************************************************************************************************************
111  ** PUBLIC ENUM
112  **********************************************************************************************************************************************************
113  *********************************************************************************************************************************************************/
114 
116  typedef enum _Config
117  {
118  PEDANTIC_CHECKS = false, //Pedantic checks inside the functions
119  SYSTICK_INVALID = 0xFFFFFFFF, //Invalid timer value
120  SYSTICK_PRE = 4, //Prescaler for the systick timer
121  TIME_INVALID = -1, //Return time in case time is invalid
124  typedef enum _Unit
125  {
128  } Unit;
129 
130  /*********************************************************************************************************************************************************
131  **********************************************************************************************************************************************************
132  ** CONSTRUCTORS
133  **********************************************************************************************************************************************************
134  *********************************************************************************************************************************************************/
135 
136  //Empty Constructor
137  Chrono( void );
138 
139  /*********************************************************************************************************************************************************
140  **********************************************************************************************************************************************************
141  ** DESTRUCTORS
142  **********************************************************************************************************************************************************
143  *********************************************************************************************************************************************************/
144 
145  //Empty Destructor
146  ~Chrono( void );
147 
148  /*********************************************************************************************************************************************************
149  **********************************************************************************************************************************************************
150  ** PUBLIC METHOD
151  **********************************************************************************************************************************************************
152  *********************************************************************************************************************************************************/
153 
154  //Snap the start time
155  void start( void );
156  //Snap the start time and invalidate the stop time and accumulator
157  void restart( void );
158  //Snap the stop time
159  void stop( void );
160  //Snap the stop time and return the elapsed time
161  int32_t stop( Unit unit );
162  //Accumulate DeltaT
163  bool accumulate( void );
164  //Accumulate DeltaT and return the accumulator time
165  int32_t accumulate( Unit unit );
166  //Return the elapsed time
167  int32_t get_elapsed( Unit unit );
168  //Return the accumulator time
169  int32_t get_accumulator( Unit unit );
170 
171  /*********************************************************************************************************************************************************
172  **********************************************************************************************************************************************************
173  ** PUBLIC STATIC METHOD
174  **********************************************************************************************************************************************************
175  *********************************************************************************************************************************************************/
176 
177  //Systick timer frequency
178  static unsigned int get_systick_freq( void );
179  //Busy wait. Blocking function
180  static bool delay( Unit unit, unsigned int delay_tmp );
181 
182  //Visible only inside the class
183  private:
184  /*********************************************************************************************************************************************************
185  **********************************************************************************************************************************************************
186  ** PRIVATE METHODS
187  **********************************************************************************************************************************************************
188  *********************************************************************************************************************************************************/
189 
190  //Compute the number of systick counts needed to count one time unit
191  static uint32_t compute_tick_per_time_unit( Unit unit );
192  //use start and stop timestamp to compute the elapsed time in a given time unit
193  int32_t compute_elapsed( uint64_t start, uint64_t stop, Unit unit );
194  //use start and stop timestamp to compute the elapsed time in a given time unit
195  int32_t compute_accumulator( uint64_t accumulator, Unit unit );
196 
197  /*********************************************************************************************************************************************************
198  **********************************************************************************************************************************************************
199  ** PRIVATE VARS
200  **********************************************************************************************************************************************************
201  *********************************************************************************************************************************************************/
202 
203  //true = accumulator mode | false = regular start stop mode
205  //Systick Timestamps
206  uint64_t g_systick_start;
207  //Combined stop and accumulator counter
208  uint64_t g_systick_stop;
209 }; //End Class: Chrono
210 
211  /*********************************************************************************************************************************************************
212  **********************************************************************************************************************************************************
213  ** CONSTRUCTORS
214  **********************************************************************************************************************************************************
215  *********************************************************************************************************************************************************/
216 
217 /***************************************************************************/
220 /***************************************************************************/
224 /***************************************************************************/
225 
227 {
228  //Initialize timestamps to invalid
229  this -> g_systick_start = Config::SYSTICK_INVALID;
230  this -> g_systick_stop = Config::SYSTICK_INVALID;
231  //Regular timer mode
232  this -> g_f_accumulator_mode = false;
233 
234  //----------------------------------------------------------------
235  // RETURN
236  //----------------------------------------------------------------
237 
238  return;
239 } //End Constructor: Chrono | void
240 
241  /*********************************************************************************************************************************************************
242  **********************************************************************************************************************************************************
243  ** DESTRUCTORS
244  **********************************************************************************************************************************************************
245  *********************************************************************************************************************************************************/
246 
247 /***************************************************************************/
249 /***************************************************************************/
252 /***************************************************************************/
253 
255 {
256  //----------------------------------------------------------------
257  // RETURN
258  //----------------------------------------------------------------
259 
260  return;
261 }
262 
263  /*********************************************************************************************************************************************************
264  **********************************************************************************************************************************************************
265  ** PUBLIC METHOD
266  **********************************************************************************************************************************************************
267  *********************************************************************************************************************************************************/
268 
269 /***************************************************************************/
272 /***************************************************************************/
276 /***************************************************************************/
277 
278 void Chrono::start( void )
279 {
280  //----------------------------------------------------------------
281  // BODY
282  //----------------------------------------------------------------
283 
284  //Snap timer start
285  this -> g_systick_start = get_timer_value();
286 
287  //----------------------------------------------------------------
288  // RETURN
289  //----------------------------------------------------------------
290 
291  return;
292 } //End method: start | void
293 
294 /***************************************************************************/
297 /***************************************************************************/
301 /***************************************************************************/
302 
303 void Chrono::restart( void )
304 {
305  //----------------------------------------------------------------
306  // BODY
307  //----------------------------------------------------------------
308 
309  //Snap timer start
310  this -> g_systick_start = get_timer_value();
311  //Infalidate stop
312  this -> g_systick_stop = Config::SYSTICK_INVALID;
313  this -> g_f_accumulator_mode = false;
314 
315  //----------------------------------------------------------------
316  // RETURN
317  //----------------------------------------------------------------
318 
319  return;
320 } //End method: start | void
321 
322 /***************************************************************************/
325 /***************************************************************************/
329 /***************************************************************************/
330 
331 void Chrono::stop( void )
332 {
333  //----------------------------------------------------------------
334  // BODY
335  //----------------------------------------------------------------
336 
337  //Snap timer start
338  this -> g_systick_stop = get_timer_value();
339  //Regular timer mode
340  this -> g_f_accumulator_mode = false;
341 
342  //----------------------------------------------------------------
343  // RETURN
344  //----------------------------------------------------------------
345 
346  return;
347 } //End method: stop | void
348 
349 /***************************************************************************/
352 /***************************************************************************/
358 /***************************************************************************/
359 
360 int32_t Chrono::stop( Unit unit )
361 {
362  //----------------------------------------------------------------
363  // CHECK
364  //----------------------------------------------------------------
365 
366  //Get start time
367  uint64_t start_tmp = this -> g_systick_start;
368  //If: bad timestamp
369  if ((Config::PEDANTIC_CHECKS == true) && (start_tmp == Config::SYSTICK_INVALID))
370  {
371  return Config::TIME_INVALID; //FAIL
372  }
373 
374  //----------------------------------------------------------------
375  // BODY
376  //----------------------------------------------------------------
377 
378  //Snap the timestamp
379  uint64_t stop_tmp = get_timer_value();
380  //Record the stop timestamp inside the timer
381  this -> g_systick_stop = stop_tmp;
382  //Regular timer mode
383  this -> g_f_accumulator_mode = false;
384 
385  //----------------------------------------------------------------
386  // RETURN
387  //----------------------------------------------------------------
388  //return elapsed time
389  return this -> compute_elapsed( start_tmp, stop_tmp, unit );
390 } //End method: stop | Unit |
391 
392 /***************************************************************************/
395 /***************************************************************************/
403 /***************************************************************************/
404 
405 bool Chrono::accumulate( void )
406 {
407  //----------------------------------------------------------------
408  // CHECK
409  //----------------------------------------------------------------
410 
411  //Get start time
412  uint64_t start_tmp = this -> g_systick_start;
413  //If: bad timestamp
414  if ((Config::PEDANTIC_CHECKS == true) && (start_tmp == Config::SYSTICK_INVALID))
415  {
416  return true; //FAIL
417  }
418  //Temp accumulator
419  uint64_t accumulator_tmp;
420  //if: Regular timer mode
421  if (this -> g_f_accumulator_mode == false)
422  {
423  //reset the accumulator
424  accumulator_tmp = 0;
425  //go into accumulator mode
426  this -> g_f_accumulator_mode = true;
427  }
428  //If: accumulator mode
429  else
430  {
431  //Fetch the current accumulator count
432  accumulator_tmp = this -> g_systick_stop;
433  }
434 
435  //----------------------------------------------------------------
436  // BODY
437  //----------------------------------------------------------------
438 
439  //Snap the timestamp
440  uint64_t stop_tmp = get_timer_value();
441  //Record the stop timestamp inside the start timestamp and invalidate the stop timestamp
442  this -> g_systick_start = stop_tmp;
443  //Accumulate the DeltaT inside the accumulator at full resolution
444  accumulator_tmp += stop_tmp -start_tmp;
445  //Store the accumulator value
446  this -> g_systick_stop = accumulator_tmp;
447 
448  //----------------------------------------------------------------
449  // RETURN
450  //----------------------------------------------------------------
451 
452  return false; //OK
453 } //End public method: accumulate | void |
454 
455 /***************************************************************************/
458 /***************************************************************************/
465 /***************************************************************************/
466 
467 int32_t Chrono::accumulate( Unit unit )
468 {
469  //----------------------------------------------------------------
470  // CHECK
471  //----------------------------------------------------------------
472 
473  //Get start time
474  uint64_t start_tmp = this -> g_systick_start;
475  //If: bad timestamp
476  if ((Config::PEDANTIC_CHECKS == true) && (start_tmp == Config::SYSTICK_INVALID))
477  {
478  return true; //FAIL
479  }
480  //Temp accumulator
481  uint64_t accumulator_tmp;
482  //if: Regular timer mode
483  if (this -> g_f_accumulator_mode == false)
484  {
485  //reset the accumulator
486  accumulator_tmp = 0;
487  //go into accumulator mode
488  this -> g_f_accumulator_mode = true;
489  }
490  //If: accumulator mode
491  else
492  {
493  //Fetch the current accumulator count
494  accumulator_tmp = this -> g_systick_stop;
495  }
496 
497  //----------------------------------------------------------------
498  // BODY
499  //----------------------------------------------------------------
500 
501  //Snap the timestamp
502  uint64_t stop_tmp = get_timer_value();
503  //Record the stop timestamp inside the start timestamp and invalidate the stop timestamp
504  this -> g_systick_start = stop_tmp;
505  //Accumulate the DeltaT inside the accumulator at full resolution
506  accumulator_tmp += stop_tmp -start_tmp;
507  //Store the accumulator value
508  this -> g_systick_stop = accumulator_tmp;
509 
510  //----------------------------------------------------------------
511  // RETURN
512  //----------------------------------------------------------------
513 
514  return this -> compute_accumulator( accumulator_tmp, unit );
515 } //End public method: accumulate | void |
516 
517 /***************************************************************************/
520 /***************************************************************************/
525 /***************************************************************************/
526 
527 int32_t Chrono::get_elapsed( Unit unit )
528 {
529  //----------------------------------------------------------------
530  // VARS
531  //----------------------------------------------------------------
532 
533  //Fetch timestamps
534  uint64_t start_tmp = this -> g_systick_start;
535  uint64_t stop_tmp = this -> g_systick_stop;
536 
537  //----------------------------------------------------------------
538  // CHECKS
539  //----------------------------------------------------------------
540 
541  //If: a timetamp is invalid
542  if ((start_tmp == Config::SYSTICK_INVALID) || (stop_tmp == Config::SYSTICK_INVALID))
543  {
544  return Config::TIME_INVALID; //Invalid
545  }
546  //If: accumulator mode
547  if (this -> g_f_accumulator_mode == true)
548  {
549  return Config::TIME_INVALID; //Invalid
550  }
551 
552  //----------------------------------------------------------------
553  // RETURN
554  //----------------------------------------------------------------
555  //return elapsed time
556  return compute_elapsed( start_tmp, start_tmp, unit );
557 } //End public getter: get_elapsed | Unit |
558 
559 /***************************************************************************/
562 /***************************************************************************/
567 /***************************************************************************/
568 
569 inline int32_t Chrono::get_accumulator( Unit unit )
570 {
571  //----------------------------------------------------------------
572  // CHECK
573  //----------------------------------------------------------------
574  //If: accumulator mode
575  if (this -> g_f_accumulator_mode == false)
576  {
577  return Config::TIME_INVALID; //Invalid
578  }
579 
580  //----------------------------------------------------------------
581  // RETURN
582  //----------------------------------------------------------------
583  //return accumulated time
584  return this -> compute_accumulator( this -> g_systick_stop, unit );
585 } //End public getter: get_elapsed | Unit |
586 
587  /*********************************************************************************************************************************************************
588  **********************************************************************************************************************************************************
589  ** PUBLIC STATIC METHOD
590  **********************************************************************************************************************************************************
591  *********************************************************************************************************************************************************/
592 
593 /***************************************************************************/
596 /***************************************************************************/
600 /***************************************************************************/
601 
602 unsigned int Chrono::get_systick_freq( void )
603 {
604  //----------------------------------------------------------------
605  // RETURN
606  //----------------------------------------------------------------
607 
608  return SystemCoreClock /Config::SYSTICK_PRE;
609 } //End static method: get_systick_freq | void
610 
611 /***************************************************************************/
614 /***************************************************************************/
622 /***************************************************************************/
623 
624 bool Chrono::delay( Unit unit, unsigned int delay_tmp )
625 {
626  //----------------------------------------------------------------
627  // VARS
628  //----------------------------------------------------------------
629 
630  //Temp timestamp
631  uint64_t systick_tmp;
632  //Compute final timestamp
633  uint64_t systick_stop;
634  //Ticks required to count 1mS
635  uint32_t numticks = compute_tick_per_time_unit( unit );
636  //If: bad unit
637  if (numticks == 0)
638  {
639  return true; //fail
640  }
641 
642  //----------------------------------------------------------------
643  // BODY
644  //----------------------------------------------------------------
645  // Wait for the correct number of ticks
646 
647  //Snap start
648  systick_stop = get_timer_value();
649  //Compute stop time.
650  systick_stop += numticks *delay_tmp;
651  //Wait an additional tick for current tick
652  systick_stop++;
653  //Busy wait for time to pass
654  do
655  {
656  //Snap timestamp
657  systick_tmp = get_timer_value();
658  }
659  while( systick_tmp < systick_stop );
660 
661  //----------------------------------------------------------------
662  // RETURN
663  //----------------------------------------------------------------
664 
665  return false; //OK
666 } //End public static method: delay | Unit | unsigned int |
667 
668  /*********************************************************************************************************************************************************
669  **********************************************************************************************************************************************************
670  ** PRIVATE METHODS
671  **********************************************************************************************************************************************************
672  *********************************************************************************************************************************************************/
673 
674 /***************************************************************************/
677 /***************************************************************************/
682 /***************************************************************************/
683 
685 {
686  //----------------------------------------------------------------
687  // BODY
688  //----------------------------------------------------------------
689  // Compute del
690 
691  //Switch: Time unit
692  switch( unit )
693  {
694  case Unit::milliseconds:
695  {
696  return SystemCoreClock /1000 /Config::SYSTICK_PRE;
697  break;
698  }
699  case Unit::microseconds:
700  {
701  return SystemCoreClock /1000000 /Config::SYSTICK_PRE;
702  break;
703  }
704  //Unhandled time unit
705  default:
706  {
707  return 0; //Invalid number of systick counts. Using it will yield infinite time
708  }
709  }; //End switch: Time unit
710 
711  //----------------------------------------------------------------
712  // RETURN
713  //----------------------------------------------------------------
714 
715  return 0; //Invalid number of systick counts. Using it will yield infinite time
716 } //End private method: compute_tick_per_time_unit | Unit |
717 
718 /***************************************************************************/
721 /***************************************************************************/
728 /***************************************************************************/
729 
730 inline int32_t Chrono::compute_elapsed( uint64_t start, uint64_t stop, Unit unit )
731 {
732  //----------------------------------------------------------------
733  // VARS
734  //----------------------------------------------------------------
735 
736  //If: causality violation
737  if ((Config::PEDANTIC_CHECKS == true) && (start > stop))
738  {
739  //Hopefully the timestamps are wrong and the universe still works as intended
740  return Config::TIME_INVALID; //FAIL
741  }
742 
743  //----------------------------------------------------------------
744  // BODY
745  //----------------------------------------------------------------
746 
747  //SysTick counts in one time unit
748  uint32_t numticks_time_unit = this -> compute_tick_per_time_unit( unit );
749  //If: bad unit was provided
750  if ((Config::PEDANTIC_CHECKS == true) && (numticks_time_unit == 0))
751  {
752  return TIME_INVALID;
753  }
754  //Compute DeltaT in system ticks as stop-start
755  uint64_t deltat = stop -start;
756  //Compute DeltaT in time units
757  deltat /= numticks_time_unit;
758  //Demote
759  int32_t ret = deltat;
760 
761  //----------------------------------------------------------------
762  // RETURN
763  //----------------------------------------------------------------
764 
765  return ret;
766 } //End private method: compute_elapsed | uint64_t | uint64_t | Unit |
767 
768 /***************************************************************************/
771 /***************************************************************************/
777 /***************************************************************************/
778 
779 int32_t Chrono::compute_accumulator( uint64_t accumulator, Unit unit )
780 {
781  //----------------------------------------------------------------
782  // VARS
783  //----------------------------------------------------------------
784 
785  //If: accumulator
786  if ((Config::PEDANTIC_CHECKS == true) && (accumulator == Config::SYSTICK_INVALID))
787  {
788  return TIME_INVALID;
789  }
790 
791  //----------------------------------------------------------------
792  // BODY
793  //----------------------------------------------------------------
794 
795  //SysTick counts in one time unit
796  uint32_t numticks_time_unit = this -> compute_tick_per_time_unit( unit );
797  //If: bad unit was provided
798  if ((Config::PEDANTIC_CHECKS == true) && (numticks_time_unit == 0))
799  {
800  return TIME_INVALID;
801  }
802  //Compute DeltaT in time units
803  accumulator /= numticks_time_unit;
804  //Demote
805  int32_t ret = accumulator;
806 
807  //----------------------------------------------------------------
808  // RETURN
809  //----------------------------------------------------------------
810 
811  return ret;
812 } //End private method: compute_accumulator | uint64_t | Unit |
813 
814 /**********************************************************************************
815 ** NAMESPACE
816 **********************************************************************************/
817 
818 } //End Namespace: Longan_nano
819 
820 #else
821  #warning "Multiple inclusion of hader file LONGAN_NANO_CHRONO_H_"
822 #endif
Longan_nano::Chrono::SYSTICK_INVALID
@ SYSTICK_INVALID
Definition: longan_nano_chrono.hpp:123
Longan_nano
Longan_nano::Chrono::~Chrono
~Chrono(void)
Empty Destructor.
Definition: longan_nano_chrono.hpp:254
Longan_nano::Chrono::PEDANTIC_CHECKS
@ PEDANTIC_CHECKS
Definition: longan_nano_chrono.hpp:122
Longan_nano::Chrono::microseconds
@ microseconds
Definition: longan_nano_chrono.hpp:127
Longan_nano::Chrono::_Config
_Config
Configurations of the SysTick.
Definition: longan_nano_chrono.hpp:117
Longan_nano::Chrono::Unit
enum Longan_nano::Chrono::_Unit Unit
Possible time units. Same names as std::Chrono.
Longan_nano::Chrono::accumulate
bool accumulate(void)
public method accumulate | void |
Definition: longan_nano_chrono.hpp:405
Longan_nano::Chrono::stop
void stop(void)
public method stop | void
Definition: longan_nano_chrono.hpp:331
Longan_nano::Chrono
Deals with busy delays, elapsed time and accumulated time.
Definition: longan_nano_chrono.hpp:106
Longan_nano::Chrono::compute_elapsed
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
Longan_nano::Chrono::get_elapsed
int32_t get_elapsed(Unit unit)
public getter get_elapsed | Unit |
Definition: longan_nano_chrono.hpp:527
Longan_nano::Chrono::get_accumulator
int32_t get_accumulator(Unit unit)
public getter get_accumulator | Unit |
Definition: longan_nano_chrono.hpp:569
Longan_nano::Chrono::milliseconds
@ milliseconds
Definition: longan_nano_chrono.hpp:126
Longan_nano::Chrono::g_systick_start
uint64_t g_systick_start
Definition: longan_nano_chrono.hpp:206
Longan_nano::Chrono::SYSTICK_PRE
@ SYSTICK_PRE
Definition: longan_nano_chrono.hpp:124
Longan_nano::Chrono::start
void start(void)
public method start | void
Definition: longan_nano_chrono.hpp:278
Longan_nano::Chrono::Chrono
Chrono(void)
Empty Constructor Chrono | void.
Definition: longan_nano_chrono.hpp:226
Longan_nano::Chrono::compute_tick_per_time_unit
static uint32_t compute_tick_per_time_unit(Unit unit)
private method compute_tick_per_time_unit | Unit |
Definition: longan_nano_chrono.hpp:684
Longan_nano::Chrono::g_f_accumulator_mode
bool g_f_accumulator_mode
Definition: longan_nano_chrono.hpp:204
Longan_nano::Chrono::restart
void restart(void)
public method start | void
Definition: longan_nano_chrono.hpp:303
Longan_nano::Chrono::get_systick_freq
static unsigned int get_systick_freq(void)
public static method get_systick_freq | void
Definition: longan_nano_chrono.hpp:602
Longan_nano::Chrono::compute_accumulator
int32_t compute_accumulator(uint64_t accumulator, Unit unit)
private method compute_accumulator | uint64_t | Unit |
Definition: longan_nano_chrono.hpp:779
Longan_nano::Chrono::_Unit
_Unit
Possible time units. Same names as std::Chrono.
Definition: longan_nano_chrono.hpp:125
Longan_nano::Chrono::TIME_INVALID
@ TIME_INVALID
Definition: longan_nano_chrono.hpp:125
Longan_nano::Chrono::g_systick_stop
uint64_t g_systick_stop
Definition: longan_nano_chrono.hpp:208
Longan_nano::Chrono::Config
enum Longan_nano::Chrono::_Config Config
Configurations of the SysTick.
Longan_nano::Chrono::delay
static bool delay(Unit unit, unsigned int delay_tmp)
public static method delay | Unit | unsigned int |
Definition: longan_nano_chrono.hpp:624