tests/ztimer_periodic: rename counter macro
The macro with name `N` is used by the MSP430 CPU macros and triggers a compilation error if this example is build for that platform. So this commit renames the repeat counter limit from `N` to `REAPEAT`.
This commit is contained in:
parent
8ec355f3d9
commit
f877ed9205
@ -32,9 +32,9 @@
|
|||||||
|
|
||||||
static mutex_t _mutex = MUTEX_INIT_LOCKED;
|
static mutex_t _mutex = MUTEX_INIT_LOCKED;
|
||||||
|
|
||||||
#define N 5
|
#define REPEAT 5
|
||||||
|
|
||||||
static uint32_t _times[N];
|
static uint32_t _times[REPEAT];
|
||||||
static int _count;
|
static int _count;
|
||||||
#define ZTIMER_CLOCKS { ZTIMER_MSEC, ZTIMER_USEC }
|
#define ZTIMER_CLOCKS { ZTIMER_MSEC, ZTIMER_USEC }
|
||||||
static const char *_names[] = { "ZTIMER_MSEC", "ZTIMER_USEC" };
|
static const char *_names[] = { "ZTIMER_MSEC", "ZTIMER_USEC" };
|
||||||
@ -54,11 +54,11 @@ static int callback(void *arg)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_count == N) {
|
if (_count == REPEAT) {
|
||||||
mutex_unlock(&_mutex);
|
mutex_unlock(&_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (_count == N);
|
return (_count == REPEAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
@ -85,10 +85,10 @@ int main(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* wait for periodic to trigger N times */
|
/* wait for periodic to trigger REPEAT times */
|
||||||
mutex_lock(&_mutex);
|
mutex_lock(&_mutex);
|
||||||
|
|
||||||
for (unsigned i = 0; i < N; i++) {
|
for (unsigned i = 0; i < REPEAT; i++) {
|
||||||
uint32_t offset = labs((int32_t)(_times[i] - _intervals[j] - last));
|
uint32_t offset = labs((int32_t)(_times[i] - _intervals[j] - last));
|
||||||
printf("i: %u time: %" PRIu32 " offset: %" PRIu32 "\n",
|
printf("i: %u time: %" PRIu32 " offset: %" PRIu32 "\n",
|
||||||
i, _times[i], offset);
|
i, _times[i], offset);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user