boards/atmega328p: Fixed xtimer frequency
The ATmega328p on a breadboard can have various frequencies depending on the fuse settings and whether and which crystal is connected. Thus, finding a fixed xtimer frequency that can be configured for every CPU core clock with the available prescalers is not possible. Therefore, the fixed frequency is replaced by a frequency depending on the CPU clock speed. For CPU clock frequency of more than 4 MHz a prescaler of 64 will be chosen (same as on the Arduino Uno), for 4 MHz and less a prescaler of 8 will be chosen.
This commit is contained in:
parent
2390d494a9
commit
f55e438d56
@ -24,6 +24,7 @@
|
||||
#define BOARD_H
|
||||
|
||||
#include "cpu.h"
|
||||
#include "periph_conf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -44,7 +45,11 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
#define XTIMER_WIDTH (16)
|
||||
#define XTIMER_HZ (250000UL)
|
||||
#if CLOCK_CORECLOCK > 4000000UL
|
||||
#define XTIMER_HZ (CLOCK_CORECLOCK / 64)
|
||||
#else
|
||||
#define XTIMER_HZ (CLOCK_CORECLOCK / 8)
|
||||
#endif
|
||||
#define XTIMER_BACKOFF (40)
|
||||
/** @} */
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user