oled 1.0
OLED Graphics Control Library
|
Header file with declarations and macros for system clock configuration. More...
#include <avr/io.h>
Go to the source code of this file.
Macros | |
#define | SYSTEM_CLOCK CLKCTRL_CLKSEL_OSC20M_gc |
Defines the system main clock source for the microcontroller. | |
#define | SYSTEM_CLOCK_BIT CLKCTRL_OSC20MS_bm |
Defines the bit mask corresponding to the current system clock source. | |
#define | SYSTEM_PER_CLOCK_PRESCALER CLKCTRL_PDIV_2X_gc |
Defines the prescaler setting for the peripheral clock (peripheral frequency). |
Functions | |
void | system_init (void) |
Initializes the system clock configuration of the microcontroller. |
Header file with declarations and macros for system clock configuration.
This file provides macro definitions, constants, and function prototypes for configuring the system clock and peripheral clock prescaler on AVR microcontrollers. It defines the available clock sources (SYSTEM_CLOCK), the corresponding status bit (SYSTEM_CLOCK_BIT), and the optional peripheral prescaler (SYSTEM_PER_CLOCK_PRESCALER).
#define SYSTEM_CLOCK CLKCTRL_CLKSEL_OSC20M_gc |
Defines the system main clock source for the microcontroller.
This macro selects the active system clock source from the available options in the AVR CLKCTRL module.
Possible values:
By default, SYSTEM_CLOCK is set to CLKCTRL_CLKSEL_OSC20M_gc (20 MHz internal oscillator).
#define SYSTEM_CLOCK_BIT CLKCTRL_OSC20MS_bm |
Defines the bit mask corresponding to the current system clock source.
This macro provides the bit mask that represents the currently selected system clock source. It is typically used when checking or configuring oscillator status bits in the CLKCTRL registers.
Possible values (depending on SYSTEM_CLOCK):
By default, SYSTEM_CLOCK_BIT is set to match CLKCTRL_CLKSEL_OSC20M_gc → CLKCTRL_OSC20MS_bm.
#define SYSTEM_PER_CLOCK_PRESCALER CLKCTRL_PDIV_2X_gc |
Defines the prescaler setting for the peripheral clock (peripheral frequency).
This macro determines how the system clock (F_CPU) is divided down to generate the peripheral clock used by timers, communication peripherals, and other hardware modules.
Possible values (from CLKCTRL module):
If the macro is undefined, the default is no prescaling (F_CPU / 1).
void system_init | ( | void | ) |
Initializes the system clock configuration of the microcontroller.
This function configures and enables the main system clock source and (optionally) the peripheral clock prescaler. The initialization sequence includes: