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:
Hauke Petersen 2021-08-25 07:57:17 +02:00
parent 8ec355f3d9
commit f877ed9205

View File

@ -32,9 +32,9 @@
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;
#define ZTIMER_CLOCKS { ZTIMER_MSEC, ZTIMER_USEC }
static const char *_names[] = { "ZTIMER_MSEC", "ZTIMER_USEC" };
@ -54,11 +54,11 @@ static int callback(void *arg)
}
#endif
if (_count == N) {
if (_count == REPEAT) {
mutex_unlock(&_mutex);
}
return (_count == N);
return (_count == REPEAT);
}
int main(void)
@ -85,10 +85,10 @@ int main(void)
return 1;
}
/* wait for periodic to trigger N times */
/* wait for periodic to trigger REPEAT times */
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));
printf("i: %u time: %" PRIu32 " offset: %" PRIu32 "\n",
i, _times[i], offset);