1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-28 16:01:18 +01:00

boards/common/arduino-atmega: define F_CPU

This fixes the following error:

$ BOARD=arduino-mega2560 make -C tests/pkg_arduino_sdi_12/
[...]
[...]/RIOT/build/pkg/arduino_sdi_12/src/SDI12_boards.cpp:35:16: error: ‘preSDI12_TCCR2B’ defined but not used [-Werror=unused-variable
   35 | static uint8_t preSDI12_TCCR2B;
This commit is contained in:
J. David Ibáñez 2021-06-21 17:41:30 +02:00
parent dbbdc8590e
commit c965ce3de6

View File

@ -170,6 +170,22 @@ static const arduino_pwm_t arduino_pwm_list[] = {
#endif
};
/**
* @brief F_CPU defines the CPU frequency in Hz.
*
* This is used in AVR's libc delay.h and setbaud.h
*
* In RIOT delay() has a different implementation using ztimer, and F_CPU is
* already defined when using setbaud.h (see cpu/atmega_common/periph/uart.c)
*
* However Arduino libraries and sketches may expect F_CPU to be defined and
* fail otherwise (for example the Arduino SDI-12 package expects this, for AVR
* cpus). For this reason we define F_CPU here, if not already defined.
*/
#ifndef F_CPU
#define F_CPU CLOCK_CORECLOCK
#endif
#ifdef __cplusplus
}
#endif