File tree 4 files changed +17
-18
lines changed
4 files changed +17
-18
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ extern "C" {
48
48
* @param None
49
49
* @retval None
50
50
*/
51
- uint32_t GetCurrentMicro (void )
51
+ uint32_t getCurrentMicros (void )
52
52
{
53
53
/* Ensure COUNTFLAG is reset by reading SysTick control and status register */
54
54
LL_SYSTICK_IsActiveCounterFlag ();
@@ -66,7 +66,7 @@ uint32_t GetCurrentMicro(void)
66
66
* @param None
67
67
* @retval None
68
68
*/
69
- uint32_t GetCurrentMilli (void )
69
+ uint32_t getCurrentMillis (void )
70
70
{
71
71
return HAL_GetTick ();
72
72
}
@@ -78,7 +78,7 @@ void noOsSystickHandler()
78
78
79
79
void osSystickHandler () __attribute__((weak , alias ("noOsSystickHandler" )));
80
80
/**
81
- * @brief Function called when t he tick interruption falls
81
+ * @brief Function called when the tick interruption falls
82
82
* @param None
83
83
* @retval None
84
84
*/
Original file line number Diff line number Diff line change @@ -58,8 +58,8 @@ typedef enum {
58
58
/* Exported constants --------------------------------------------------------*/
59
59
/* Exported macro ------------------------------------------------------------*/
60
60
/* Exported functions ------------------------------------------------------- */
61
- uint32_t GetCurrentMilli (void );
62
- uint32_t GetCurrentMicro (void );
61
+ uint32_t getCurrentMillis (void );
62
+ uint32_t getCurrentMicros (void );
63
63
64
64
void enableClock (sourceClock_t source );
65
65
#ifdef __cplusplus
Original file line number Diff line number Diff line change @@ -24,25 +24,24 @@ extern "C" {
24
24
25
25
uint32_t millis (void )
26
26
{
27
- // todo : ensure no interrupts
28
- return GetCurrentMilli () ;
27
+ // ToDo : ensure no interrupts
28
+ return getCurrentMillis () ;
29
29
}
30
30
31
31
// Interrupt-compatible version of micros
32
32
uint32_t micros (void )
33
33
{
34
- return GetCurrentMicro ();
34
+ return getCurrentMicros ();
35
35
}
36
36
37
37
void delay (uint32_t ms )
38
38
{
39
- if (ms == 0 ) {
40
- return ;
39
+ if (ms != 0 ) {
40
+ uint32_t start = getCurrentMillis ();
41
+ do {
42
+ yield ();
43
+ } while (getCurrentMillis () - start < ms );
41
44
}
42
- uint32_t start = GetCurrentMilli ();
43
- do {
44
- yield ();
45
- } while (GetCurrentMilli () - start < ms );
46
45
}
47
46
48
47
#ifdef __cplusplus
Original file line number Diff line number Diff line change @@ -51,9 +51,9 @@ extern uint32_t micros(void) ;
51
51
* \brief Pauses the program for the amount of time (in miliseconds) specified as parameter.
52
52
* (There are 1000 milliseconds in a second.)
53
53
*
54
- * \param dwMs the number of milliseconds to pause (uint32_t)
54
+ * \param ms the number of milliseconds to pause (uint32_t)
55
55
*/
56
- extern void delay (uint32_t dwMs ) ;
56
+ extern void delay (uint32_t ms ) ;
57
57
58
58
/**
59
59
* \brief Pauses the program for the amount of time (in microseconds) specified as parameter.
@@ -69,8 +69,8 @@ static inline void delayMicroseconds(uint32_t us)
69
69
70
70
while ((int32_t )dwt_getCycles () - start < cycles );
71
71
#else
72
- uint32_t start = GetCurrentMicro ();
73
- while ((start + usec ) > GetCurrentMicro ());
72
+ uint32_t start = getCurrentMicros ();
73
+ while ((start + us ) > getCurrentMicros ());
74
74
#endif
75
75
}
76
76
You can’t perform that action at this time.
0 commit comments