rcc 1.0
RCC - RGB LED Color Cube Documentation
|
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 |
Bit mask representing the current system clock source status. | |
#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 |
Bit mask representing the current system clock source status.
This macro defines the bit mask corresponding to the currently selected system clock source, used primarily for status checking and register configuration within the CLKCTRL peripheral.
The value depends on the predefined SYSTEM_CLOCK macro:
By default, SYSTEM_CLOCK_BIT is automatically set to match the bit mask corresponding to the selected SYSTEM_CLOCK.
#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: