Skip to content

Commit 5e694ae

Browse files
committed
[Time] Code format
Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 6443bed commit 5e694ae

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

cores/arduino/stm32/clock.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ extern "C" {
4848
* @param None
4949
* @retval None
5050
*/
51-
uint32_t GetCurrentMicro(void)
51+
uint32_t getCurrentMicros(void)
5252
{
5353
/* Ensure COUNTFLAG is reset by reading SysTick control and status register */
5454
LL_SYSTICK_IsActiveCounterFlag();
@@ -66,7 +66,7 @@ uint32_t GetCurrentMicro(void)
6666
* @param None
6767
* @retval None
6868
*/
69-
uint32_t GetCurrentMilli(void)
69+
uint32_t getCurrentMillis(void)
7070
{
7171
return HAL_GetTick();
7272
}
@@ -78,7 +78,7 @@ void noOsSystickHandler()
7878

7979
void osSystickHandler() __attribute__((weak, alias("noOsSystickHandler")));
8080
/**
81-
* @brief Function called when t he tick interruption falls
81+
* @brief Function called when the tick interruption falls
8282
* @param None
8383
* @retval None
8484
*/

cores/arduino/stm32/clock.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ typedef enum {
5858
/* Exported constants --------------------------------------------------------*/
5959
/* Exported macro ------------------------------------------------------------*/
6060
/* Exported functions ------------------------------------------------------- */
61-
uint32_t GetCurrentMilli(void);
62-
uint32_t GetCurrentMicro(void);
61+
uint32_t getCurrentMillis(void);
62+
uint32_t getCurrentMicros(void);
6363

6464
void enableClock(sourceClock_t source);
6565
#ifdef __cplusplus

cores/arduino/wiring_time.c

+8-9
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,24 @@ extern "C" {
2424

2525
uint32_t millis(void)
2626
{
27-
// todo: ensure no interrupts
28-
return GetCurrentMilli() ;
27+
// ToDo: ensure no interrupts
28+
return getCurrentMillis();
2929
}
3030

3131
// Interrupt-compatible version of micros
3232
uint32_t micros(void)
3333
{
34-
return GetCurrentMicro();
34+
return getCurrentMicros();
3535
}
3636

3737
void delay(uint32_t ms)
3838
{
39-
if (ms == 0) {
40-
return;
39+
if (ms != 0) {
40+
uint32_t start = getCurrentMillis();
41+
do {
42+
yield();
43+
} while (getCurrentMillis() - start < ms);
4144
}
42-
uint32_t start = GetCurrentMilli();
43-
do {
44-
yield();
45-
} while (GetCurrentMilli() - start < ms);
4645
}
4746

4847
#ifdef __cplusplus

cores/arduino/wiring_time.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ extern uint32_t micros(void) ;
5151
* \brief Pauses the program for the amount of time (in miliseconds) specified as parameter.
5252
* (There are 1000 milliseconds in a second.)
5353
*
54-
* \param dwMs the number of milliseconds to pause (uint32_t)
54+
* \param ms the number of milliseconds to pause (uint32_t)
5555
*/
56-
extern void delay(uint32_t dwMs) ;
56+
extern void delay(uint32_t ms) ;
5757

5858
/**
5959
* \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)
6969

7070
while ((int32_t)dwt_getCycles() - start < cycles);
7171
#else
72-
uint32_t start = GetCurrentMicro();
73-
while ((start + usec) > GetCurrentMicro());
72+
uint32_t start = getCurrentMicros();
73+
while ((start + us) > getCurrentMicros());
7474
#endif
7575
}
7676

0 commit comments

Comments
 (0)