# exothink/exocan architecture

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

- Interactive diagram: https://gitdiagram.com/exothink/exocan
- Repository: https://github.com/exothink/exocan

## Overview

eXoCAN is an STM32F103 Arduino library that exposes a CAN controller API. Its main workflow initializes the MCU pins and CAN peripheral, configures acceptance filters, then transmits or receives frames; receive interrupts are optional. The library also supports standard and extended IDs, several bit rates and bus-wiring modes, listen-only operation, retry control, and byte/integer frame views. The graph focuses on the two core modules and hardware interactions documented in the excerpts and README; it does not map example sketches.

Main entry points: [`eXoCAN.h`](https://github.com/exothink/exocan/blob/master/eXoCAN.h) (eXoCAN API and frame types), [`eXoCAN.cpp`](https://github.com/exothink/exocan/blob/master/eXoCAN.cpp) (Controller initialization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Controller setup"]
  node_startup["Controller initialization<br/>[eXoCAN.cpp]"]
  node_pins["Pin and bus setup<br/>[eXoCAN.cpp]"]
  node_peripheral["CAN peripheral"]
end

subgraph group_frames["Frame handling"]
  node_api["eXoCAN API and frame types<br/>[eXoCAN.h]"]
  node_transmit["Frame transmit<br/>[eXoCAN.cpp]"]
  node_receive["Frame receive<br/>[eXoCAN.cpp]"]
end

subgraph group_control["Filtering and interrupts"]
  node_filters["Acceptance filters<br/>[eXoCAN.cpp]"]
  node_interrupts["Receive interrupts<br/>[eXoCAN.cpp]"]
  node_nvic["Interrupt controller"]
end

node_caller(("Arduino application"))

node_caller -->|"uses"| node_api
node_api -->|"constructs via"| node_startup
node_startup -->|"configures"| node_pins
node_startup -->|"initializes"| node_peripheral
node_startup -->|"sets defaults"| node_filters
node_api -->|"configures"| node_filters
node_api -->|"sends frames"| node_transmit
node_transmit -->|"writes mailbox"| node_peripheral
node_api -->|"reads frames"| node_receive
node_receive -->|"reads FIFO"| node_peripheral
node_api -->|"attaches handler"| node_interrupts
node_interrupts -->|"enables IRQ"| node_nvic
node_interrupts -->|"enables RX IRQ"| node_peripheral

click node_api "https://github.com/exothink/exocan/blob/master/eXoCAN.h"
click node_startup "https://github.com/exothink/exocan/blob/master/eXoCAN.cpp"
click node_pins "https://github.com/exothink/exocan/blob/master/eXoCAN.cpp"
click node_filters "https://github.com/exothink/exocan/blob/master/eXoCAN.cpp"
click node_transmit "https://github.com/exothink/exocan/blob/master/eXoCAN.cpp"
click node_receive "https://github.com/exothink/exocan/blob/master/eXoCAN.cpp"
click node_interrupts "https://github.com/exothink/exocan/blob/master/eXoCAN.cpp"

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_startup,node_pins,node_peripheral toneBlue
class node_api,node_transmit,node_receive toneAmber
class node_filters,node_interrupts,node_nvic toneMint
class node_caller toneIndigo
```

## Components

### Controller setup

- [Controller initialization](https://github.com/exothink/exocan/blob/master/eXoCAN.cpp): `eXoCAN.cpp`
- [Pin and bus setup](https://github.com/exothink/exocan/blob/master/eXoCAN.cpp): `eXoCAN.cpp`
- **CAN peripheral**

### Frame handling

- [eXoCAN API and frame types](https://github.com/exothink/exocan/blob/master/eXoCAN.h): `eXoCAN.h`
- [Frame transmit](https://github.com/exothink/exocan/blob/master/eXoCAN.cpp): `eXoCAN.cpp`
- [Frame receive](https://github.com/exothink/exocan/blob/master/eXoCAN.cpp): `eXoCAN.cpp`

### Filtering and interrupts

- [Acceptance filters](https://github.com/exothink/exocan/blob/master/eXoCAN.cpp): `eXoCAN.cpp`
- [Receive interrupts](https://github.com/exothink/exocan/blob/master/eXoCAN.cpp): `eXoCAN.cpp`
- **Interrupt controller**

### Other components

- **Arduino application**

## Connections

- Arduino application → eXoCAN API and frame types: uses (evidence: `README.md`)
- eXoCAN API and frame types → Controller initialization: constructs via (evidence: `eXoCAN.h`)
- Controller initialization → Pin and bus setup: configures (evidence: `eXoCAN.cpp`)
- Controller initialization → CAN peripheral: initializes (evidence: `eXoCAN.cpp`)
- Controller initialization → Acceptance filters: sets defaults (evidence: `eXoCAN.cpp`)
- eXoCAN API and frame types → Acceptance filters: configures (evidence: `eXoCAN.h`)
- eXoCAN API and frame types → Frame transmit: sends frames (evidence: `eXoCAN.h`)
- Frame transmit → CAN peripheral: writes mailbox (evidence: `eXoCAN.cpp`)
- eXoCAN API and frame types → Frame receive: reads frames (evidence: `eXoCAN.h`)
- Frame receive → CAN peripheral: reads FIFO (evidence: `eXoCAN.cpp`)
- eXoCAN API and frame types → Receive interrupts: attaches handler (evidence: `eXoCAN.h`)
- Receive interrupts → Interrupt controller: enables IRQ (evidence: `eXoCAN.cpp`)
- Receive interrupts → CAN peripheral: enables RX IRQ (evidence: `eXoCAN.cpp`)
