# spencekonde/dxcore architecture

> Architecture diagram of the GitHub repository spencekonde/dxcore, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/spencekonde/dxcore
- Repository: https://github.com/spencekonde/dxcore

## Overview

DxCore is an Arduino core for Microchip AVR DA, DB, DD, EA, EB, and DU microcontrollers. The principal workflow is an Arduino sketch using the core’s API and device-specific pin/peripheral definitions to interact with MCU hardware. The repository also supplies optional peripheral libraries and Optiboot bootloaders. The README documents broad device and hardware support; sampled evidence is strongest for core headers, timer configuration, and selected library interfaces, so unsampled implementation links are omitted.

Main entry points: [`megaavr/cores/dxcore/Arduino.h`](https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/Arduino.h) (Arduino API), [`megaavr/cores/dxcore/api/Print.h`](https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/api/Print.h) (Print and Stream), [`megaavr/variants/14pin-ddseries/pins_arduino.h`](https://github.com/spencekonde/dxcore/blob/master/megaavr/variants/14pin-ddseries/pins_arduino.h) (Board Pin Mapping), [`megaavr/cores/dxcore/timers.h`](https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/timers.h) (Timer Support)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Arduino Core"]
  node_runtime["Core Runtime<br/>[main.cpp]"]
  node_arduinoapi["Arduino API<br/>[Arduino.h]"]
  node_print["Print and Stream<br/>[Print.h]"]
  node_string["String Types<br/>[String.h]"]
  node_printable["Printable Types<br/>[Printable.h]"]
end

subgraph group_hardware["Device Hardware"]
  node_device["Device Definitions<br/>[core_devices.h]"]
  node_pins["Board Pin Mapping<br/>[pins_arduino.h]"]
  node_timerpins["Timer Pin Mapping"]
  node_timers["Timer Support<br/>[timers.h]"]
  node_uart["UART Configuration<br/>[UART_constants.h]"]
end

subgraph group_libraries["Peripheral Libraries"]
  node_event["Event System<br/>[Event.cpp]"]
  node_comparator["Comparator<br/>[Comparator.cpp]"]
  node_logic["Configurable Logic<br/>[Logic.cpp]"]
  node_wire["I2C Wire<br/>[Wire.cpp]"]
  node_spi["SPI<br/>[SPI.cpp]"]
  node_sd["SD Storage<br/>[SD.cpp]"]
  node_flash["Flash Access<br/>[Flash.cpp]"]
end

subgraph group_boot["Bootloaders"]
  node_optiboot["Optiboot<br/>[optiboot_dx.c]"]
  node_optibootdx["Dx Optiboot Variant<br/>[optiboot_dx.c]"]
end

node_sketch(("Arduino Sketch"))

node_sketch -.->|"uses API"| node_arduinoapi
node_arduinoapi -->|"includes definitions"| node_device
node_arduinoapi -->|"includes mapping"| node_timerpins
node_arduinoapi -->|"includes settings"| node_uart
node_arduinoapi -->|"includes pin map"| node_pins
node_print -->|"uses types"| node_string
node_print -->|"uses types"| node_printable
node_timers -->|"uses parameters"| node_device
node_pins -->|"references timers"| node_timers
node_wire -->|"includes core"| node_arduinoapi

click node_runtime "https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/main.cpp"
click node_arduinoapi "https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/Arduino.h"
click node_print "https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/api/Print.h"
click node_string "https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/api/String.h"
click node_printable "https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/api/Printable.h"
click node_device "https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/core_devices.h"
click node_pins "https://github.com/spencekonde/dxcore/blob/master/megaavr/variants/14pin-ddseries/pins_arduino.h"
click node_timerpins "https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/device_timer_pins.h"
click node_timers "https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/timers.h"
click node_uart "https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/UART_constants.h"
click node_event "https://github.com/spencekonde/dxcore/blob/master/megaavr/libraries/Event/src/Event.cpp"
click node_comparator "https://github.com/spencekonde/dxcore/blob/master/megaavr/libraries/Comparator/src/Comparator.cpp"
click node_logic "https://github.com/spencekonde/dxcore/blob/master/megaavr/libraries/Logic/src/Logic.cpp"
click node_wire "https://github.com/spencekonde/dxcore/blob/master/megaavr/libraries/Wire/src/Wire.cpp"
click node_spi "https://github.com/spencekonde/dxcore/blob/master/megaavr/libraries/SPI/src/SPI.cpp"
click node_sd "https://github.com/spencekonde/dxcore/blob/master/megaavr/libraries/SD/src/SD.cpp"
click node_flash "https://github.com/spencekonde/dxcore/blob/master/megaavr/libraries/Flash/src/Flash.cpp"
click node_optiboot "https://github.com/spencekonde/dxcore/blob/master/megaavr/bootloaders/optiboot_dx/optiboot_dx.c"
click node_optibootdx "https://github.com/spencekonde/dxcore/blob/master/megaavr/bootloaders/optiboot_dex/optiboot_dx.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_runtime,node_arduinoapi,node_print,node_string,node_printable toneBlue
class node_device,node_pins,node_timerpins,node_timers,node_uart toneAmber
class node_event,node_comparator,node_logic,node_wire,node_spi,node_sd,node_flash toneMint
class node_optiboot,node_optibootdx toneRose
class node_sketch toneIndigo
```

## Components

### Arduino Core

- [Core Runtime](https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/main.cpp): `megaavr/cores/dxcore/main.cpp`
- [Arduino API](https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/Arduino.h): `megaavr/cores/dxcore/Arduino.h`
- [Print and Stream](https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/api/Print.h): `megaavr/cores/dxcore/api/Print.h`
- [String Types](https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/api/String.h): `megaavr/cores/dxcore/api/String.h`
- [Printable Types](https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/api/Printable.h): `megaavr/cores/dxcore/api/Printable.h`

### Device Hardware

- [Device Definitions](https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/core_devices.h): `megaavr/cores/dxcore/core_devices.h`
- [Board Pin Mapping](https://github.com/spencekonde/dxcore/blob/master/megaavr/variants/14pin-ddseries/pins_arduino.h): `megaavr/variants/14pin-ddseries/pins_arduino.h`
- [Timer Pin Mapping](https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/device_timer_pins.h): `megaavr/cores/dxcore/device_timer_pins.h`
- [Timer Support](https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/timers.h): `megaavr/cores/dxcore/timers.h`
- [UART Configuration](https://github.com/spencekonde/dxcore/blob/master/megaavr/cores/dxcore/UART_constants.h): `megaavr/cores/dxcore/UART_constants.h`

### Peripheral Libraries

- [Event System](https://github.com/spencekonde/dxcore/blob/master/megaavr/libraries/Event/src/Event.cpp): `megaavr/libraries/Event/src/Event.cpp`
- [Comparator](https://github.com/spencekonde/dxcore/blob/master/megaavr/libraries/Comparator/src/Comparator.cpp): `megaavr/libraries/Comparator/src/Comparator.cpp`
- [Configurable Logic](https://github.com/spencekonde/dxcore/blob/master/megaavr/libraries/Logic/src/Logic.cpp): `megaavr/libraries/Logic/src/Logic.cpp`
- [I2C Wire](https://github.com/spencekonde/dxcore/blob/master/megaavr/libraries/Wire/src/Wire.cpp): `megaavr/libraries/Wire/src/Wire.cpp`
- [SPI](https://github.com/spencekonde/dxcore/blob/master/megaavr/libraries/SPI/src/SPI.cpp): `megaavr/libraries/SPI/src/SPI.cpp`
- [SD Storage](https://github.com/spencekonde/dxcore/blob/master/megaavr/libraries/SD/src/SD.cpp): `megaavr/libraries/SD/src/SD.cpp`
- [Flash Access](https://github.com/spencekonde/dxcore/blob/master/megaavr/libraries/Flash/src/Flash.cpp): `megaavr/libraries/Flash/src/Flash.cpp`

### Bootloaders

- [Optiboot](https://github.com/spencekonde/dxcore/blob/master/megaavr/bootloaders/optiboot_dx/optiboot_dx.c): `megaavr/bootloaders/optiboot_dx/optiboot_dx.c`
- [Dx Optiboot Variant](https://github.com/spencekonde/dxcore/blob/master/megaavr/bootloaders/optiboot_dex/optiboot_dx.c): `megaavr/bootloaders/optiboot_dex/optiboot_dx.c`

### Other components

- **Arduino Sketch**

## Connections

- Arduino Sketch → Arduino API: uses API
- Arduino API → Device Definitions: includes definitions (evidence: `megaavr/cores/dxcore/Arduino.h`)
- Arduino API → Timer Pin Mapping: includes mapping (evidence: `megaavr/cores/dxcore/Arduino.h`)
- Arduino API → UART Configuration: includes settings (evidence: `megaavr/cores/dxcore/Arduino.h`)
- Arduino API → Board Pin Mapping: includes pin map (evidence: `megaavr/cores/dxcore/Arduino.h`)
- Print and Stream → String Types: uses types (evidence: `megaavr/cores/dxcore/api/Print.h`)
- Print and Stream → Printable Types: uses types (evidence: `megaavr/cores/dxcore/api/Print.h`)
- Timer Support → Device Definitions: uses parameters (evidence: `megaavr/cores/dxcore/timers.h`)
- Board Pin Mapping → Timer Support: references timers
- I2C Wire → Arduino API: includes core (evidence: `megaavr/libraries/Wire/src/Wire.cpp`)
