Skip to content

feat(boards): add the ATtiny85 board hardware and its rules (P6.4) - #336

Merged
ttbombadil merged 5 commits into
feature/browser-emulationfrom
feat/p6-4-attiny85-board
Oct 24, 2026
Merged

ttbombadil merged 5 commits into
feature/browser-emulationfrom
feat/p6-4-attiny85-board

Conversation

@ttbombadil

Copy link
Copy Markdown
Collaborator

Paket

P6.4 Board-Hardware und Regeln ATtiny85 (M). Gestapelt auf #335 → #334. Die Basis ist feature/browser-emulation; bis die Vorgänger gemergt sind, enthält der Diff deren Commits mit. Merge-Reihenfolge: #334, #335, dann dieser PR.

Umgesetzt

Paket

  • ATTINY85_BOARD, gegen variants/tinyX5/pins_arduino.h geprüft:

    • Pins 0–5 sind PB0–PB5, 8 MHz, LED_BUILTIN 1;
    • A0–A3 sind Zweitnamen der Pins 5, 2, 4, 3 (neues Feld analogName);
    • PWM an 0 (Timer 0 A), 1 (Timer 1 A, TIMER1_PWM) und 4 (Timer 1 B);
    • PB5 hat die Rolle reset; Serial ist ein Port der Art software an 0 (TX) und 1 (RX).
  • Profil und Hardware des ATtiny85 sind jetzt in mcuProfile und boardHardware registriert.

  • SerialPorts nimmt einen USART oder einen SoftwareUart (feat(emulator): model the software UART of the ATtiny85 (P6.3) #335). setFallbackBaud setzt die Rate, mit der dekodiert wird, bis die Leitung die des Sketches zeigt; angebunden wird es mit P6.5.

  • PWM-Beobachtung für Timer 1 des ATtiny85:

    • Tastverhältnis aus TCCR1/GTCCR (PWM1x, COM1x), OCR1x und OCR1C als TOP;
    • pwmChannelRegisters gibt io-usage eine gemeinsame Sicht auf alle Timer.

    Die Pinanzeige zeigt damit analogWrite(4, 200) richtig, obwohl avr8js dort kein Signal erzeugt (feat(emulator): add the ATtiny85 MCU profile (P6.2) #334).

Shared und Parser

  • Das Pinmodell kennt analogName; resolveBoardPin("attiny85", "A1") liefert 2, boardPinAliases liefert die Zweitnamen.

  • Die Parser rechnen wie ATTinyCore: A<n> ist 0x80 | n und wird in jeder Pinfunktion zum Pin; analogRead(n) nimmt den Kanal n (pinContext.analogValue, isPinValue, callPin). Ohne das wurde analogRead(A1) zu Pin 4. Beim Uno, Nano und Mega bleibt alles wie vorher; das zeigen die bestehenden Parser-Tests.

  • Neue Warnungen:

    • digitale Nutzung des RESET-Pins PB5 (analogRead(A0) bleibt erlaubt);
    • andere Nutzung von PB0/PB1, wenn der Sketch Serial verwendet.

    Serial1 gibt es nicht; das deckte die bestehende Regel schon ab.

Toolchain-Gate: Ein neuer Fall in avr-emulator-board-pinmap.test.ts prüft Port, Bit, Timer, Analogkanäle und LED_BUILTIN gegen ATTinyCore. analogInputToDigitalPin(n) und LED_BUILTIN (( 1)) wertet der Compiler des Cores aus (-S, .word lesen), weil der Präprozessor diese Ausdrücke nicht ausrechnet.

Doku: SSOT Boards (Pinmodell und Regeln ATtiny85), README des Pakets, Plan, Status.

Abnahmeevidenz

  • tests/attiny85-board.test.ts (8 Fälle), über den Emulator:
    • Serial über den Software-UART und Eingabe mit Antwort;
    • Rückfall-Baudrate;
    • PWM 200 und 77 in der Pinanzeige, analogWrite in der I/O-Registry;
    • Analogwert am Pin.
  • tests/shared/attiny85-pins-and-rules.test.ts: 8 Fälle.
  • Gates:
    • Unit: App 3570, Emulator 663 Tests;
    • Toolchain-Gate: 128 Tests (144 s von 300 s);
    • npm run build mit Bundle 690,1 kB von 710 kB;
    • E2E 51/51;
    • check, lint, knip, check:docs, Pre-Push mit Sonar (zwei S3358 behoben).

Abweichungen vom Plan

Der Board-Status bleibt planned. Die Freigabe als preview ist P6.5, zusammen mit der UI (DIP-8-Grafik, Analognamen in der Anzeige), dem Korpus und dem E2E-Test.

Geänderte bestehende Tests (freigegeben vom Nutzer am 23.10.2026)

Fünf Tests nutzten attiny85 als Beispiel für ein „Board ohne Hardware-Profil“. Sie prüfen den Rückfall jetzt mit einer unbekannten ID; die Prüfung selbst bleibt:

  • packages/avr-emulator/tests/atmega328p-boards.test.ts:39–41
  • tests/client/lib/active-board.test.ts
  • tests/shared/board-pins.test.ts
  • tests/shared/boards.test.ts (boardPinAliases)
  • tests/shared/parsers-per-board.test.ts (Rückfall auf den Uno)

Ohne Freigabe nötig, weil keine Prüfung geändert wurde: Der Helfer in avr-emulator-board-pinmap.test.ts ist umgebaut (coreProperties); die drei bestehenden Board-Fälle sind unverändert.

🤖 Generated with Claude Code

ttbombadil and others added 5 commits October 23, 2026 19:57
Port B with INT0 and PCINT0, timer 0 with its own registers and one-word
vectors, the ATtiny timer 1, a four-channel ADC that reads REFS2 at bit 4,
EEPROM timed for 8 MHz, watchdog and clock prescaler. INT0 and the pin-change
interrupt share GIMSK and GIFR, which avr8js wires for one of them only; the
profile wraps both hooks. Registered with the board hardware in P6.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TX is decoded from PB0 with the baud rate found from the edge distances and
the bit width measured from them; RX drives PB1 through an analog comparator
model. SoftwareUart offers the USART members SerialPorts uses, for the
ATtiny85 board.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pins 0-5 as PB0-PB5 with A0-A3 as second names, PWM on 0, 1 and 4, RESET on
PB5 and Serial as a software port on 0/1. SerialPorts takes a USART or the
software UART, the PWM observation reads timer 1 of the ATtiny85, and the
sketch parsers resolve A<n> and analogRead(n) as ATTinyCore does. The pin
map is checked against the core in the toolchain gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ttbombadil
ttbombadil merged commit 26e59c1 into feature/browser-emulation Oct 24, 2026
6 checks passed
@ttbombadil
ttbombadil deleted the feat/p6-4-attiny85-board branch October 24, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant