1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #15035 from maribu/test_periph_timer_etc

tests/periph_timer_{periodic, short_relative_set}: Drop include of `xtimer.h`
This commit is contained in:
benpicco 2020-09-17 16:29:36 +02:00 committed by GitHub
commit acf14f8a2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 11 deletions

View File

@ -22,11 +22,20 @@
#include <stdint.h>
#include "board.h"
#include "test_utils/expect.h"
#include "macros/units.h"
#include "mutex.h"
#include "periph/timer.h"
#include "xtimer.h"
#include "test_utils/expect.h"
/* recreate logic to obtain valid XTIMER_DEV used in xtimer.h, but don't include
* xtimer.h, as this leads to issues on some boards when the xtimer module is
* not used */
#ifndef XTIMER_DEV
#define XTIMER_DEV TIMER_DEV(0)
#endif
#ifndef XTIMER_HZ
#define XTIMER_HZ MHZ(1)
#endif
/* We use the timer used for xtimer with the frequency used by xtimer here
* to make sure we have a known valid timer configuration.

View File

@ -23,20 +23,35 @@
#include <stdlib.h>
#include "board.h"
#include "macros/units.h"
#include "thread.h"
#include "thread_flags.h"
#include "periph/timer.h"
#ifndef TEST_TIMER_DEV
# include "xtimer.h"
# define TEST_TIMER_DEV XTIMER_DEV
# define TEST_TIMER_FREQ XTIMER_HZ
# define TEST_TIMER_WIDTH XTIMER_WIDTH
#else
# ifndef TEST_TIMER_FREQ
# define TEST_TIMER_FREQ (1000000LU)
/* recreate logic to obtain valid XTIMER_DEV used in xtimer.h, but don't include
* xtimer.h, as this leads to issues on some boards when the xtimer module is
* not used */
#ifndef XTIMER_DEV
# define XTIMER_DEV TIMER_DEV(0)
#endif
#ifndef XTIMER_HZ
# define XTIMER_HZ MHZ(1)
#endif
#ifndef XTIMER_WIDTH
# if(TIMER_0_MAX_VALUE) == 0xfffffful
# define XTIMER_WIDTH (24)
# elif (TIMER_0_MAX_VALUE) == 0xffff
# define XTIMER_WIDTH (16)
# else
# define XTIMER_WIDTH (32)
# endif
#endif /* !defined(XTIMER_WIDTH) */
#ifndef TEST_TIMER_FREQ
# define TEST_TIMER_DEV XTIMER_DEV
# define TEST_TIMER_FREQ XTIMER_HZ
# define TEST_TIMER_WIDTH XTIMER_WIDTH
#endif
#ifndef TEST_MAX_DIFF