1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 15:03:53 +01:00

drivers/rtt: overrite RTT_MAX_VALUE and RTT_FREQUENCY for mock

mock_rtt relies on setting mock values for RTT_MAX_VALUE and
RTT_FREQUENCY. Platforms with a rtt will already define these
values which leads to mock_rtt working with different values than
rtt_rtc.

This commit changes the ifdef logic so that when using mock_rtt
RTT_MAX_VALUE and RTT_FREQUENCY are redefined.
This commit is contained in:
Francisco Molina 2020-07-21 15:21:07 +02:00
parent e8a8d12d96
commit 9dde6ec53d
No known key found for this signature in database
GPG Key ID: 3E94EAC3DBDEEDA8

View File

@ -79,21 +79,23 @@ extern "C" {
#define RTT_MIN_OFFSET (2U)
#endif
#ifndef RTT_FREQUENCY
/* Allow mock-RTT for unit tests */
#ifdef MOCK_RTT_FREQUENCY
#undef RTT_FREQUENCY
#define RTT_FREQUENCY MOCK_RTT_FREQUENCY
#else
#ifndef RTT_FREQUENCY
#warning "RTT_FREQUENCY undefined. Set RTT_FREQUENCY to the number of ticks " \
"per second for the current architecture."
#endif
#endif
#ifndef RTT_MAX_VALUE
/* Allow mock-RTT for unit tests */
#ifdef MOCK_RTT_MAX_VALUE
#undef RTT_MAX_VALUE
#define RTT_MAX_VALUE MOCK_RTT_MAX_VALUE
#else
#ifndef RTT_MAX_VALUE
#warning "RTT_MAX_VALUE is undefined. Set RTT_MAX_VALUE to the maximum value " \
"for the RTT counter, ensure it is (2^n - 1)."
#endif