Skip to content

Implement SiliconTwin.Abstractions: AvrMcu, batch GPIO, pin events, ADC pull, PWM info - #31

Draft
begeistert wants to merge 1 commit into
fix/emulator-fidelityfrom
feat/silicontwin-abstractions
Draft

begeistert wants to merge 1 commit into
fix/emulator-fidelityfrom
feat/silicontwin-abstractions

Conversation

@begeistert

Copy link
Copy Markdown
Collaborator

Stacked on #30. Implements the shared embedder contract SiliconTwin.Abstractions (silicon-twin/abstractions#1).

Draft until SiliconTwin.Abstractions 0.1.0 is on nuget.org. CI cannot restore until then. It was built and tested locally against the packed package.

  • AvrBuilder.BuildMcu(name) returns an AvrMcu (IMcu, IGpio, IPwmSource, IAdcInput, IPeripheralMap) over everything the builder mounted, with no glue.
  • Ports:
    • batch SetInputs/ReleaseInputs/ApplyInputs
    • OutputEnableMask/OutputLevels/PullUpMask
    • PinChanged with the cycle and a WatchMask, costing one null check when unused
  • ADC pull callback ReadChannelVolts.
  • PWM frequency and duty from the timer state.
  • UART, SPI and I2C at byte level.
  • C ABI and Python for the batch GPIO.
  • The core is IsTrimmable/IsAotCompatible, and CI publishes and runs a Native AOT smoke test.

No emulation behaviour changes; the additions are accessors and events.

Local results:

…nts, ADC pull, PWM info)

AvrBuilder.BuildMcu returns an AvrMcu over everything the builder mounted:
IMcu (cycle-budget Run, Reset, Load), one IPinBank per port with batch
SetInputs/ReleaseInputs and cycle-stamped PinChanged events, IPwmSource from
the timer state, IAdcInput with a pull callback, and byte-level UART, SPI
and I2C ports.

The pieces underneath are public on their own: AvrIoPort.SetInputs,
ReleaseInputs, ApplyInputs, OutputEnableMask, OutputLevels, PullUpMask,
PinChanged; AvrAdc.ReadChannelVolts; AvrTimer.TryGetPwm; AvrClock.Changed.
Exposed over the C ABI and Python. The core is now trimmable and AOT
compatible, with a Native AOT smoke test in CI.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying avr8sharp-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3b6d26e
Status: ✅  Deploy successful!
Preview URL: https://2d2b69be.avr8sharp-docs.pages.dev
Branch Preview URL: https://feat-silicontwin-abstraction.avr8sharp-docs.pages.dev

View logs

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