<whitequark[cis]>
so, i've realized just now that i've been doing applets wrong
<whitequark[cis]>
they're kind of ... inside out
<whitequark[cis]>
right now we have a *Applet class which has an imperative build process where it adds arguments, builds gateware, then creates a software driver for it
<whitequark[cis]>
this is all done externally to all of these entities
<whitequark[cis]>
this works fine up until the moment where you want to do composition
<_whitenotifier-3>
[glasgow] github-merge-queue[bot] created branch gh-readonly-queue/main/pr-630-4c1217661826dd3f461caabbe8809cab24e06ce1 - https://github.com/GlasgowEmbedded/glasgow
<whitequark[cis]>
because then anything that tries to compose with an existing applet is exposed to many of its implementation details, in a really gnarly way
<whitequark[cis]>
thing is, e.g. memory-25x should not care whatsoever how the SPI is implemented, only that it is implemented
<whitequark[cis]>
all it should talk to is the SPI controller that was given to it. and the consumer of an SPI controller API shouldn't care that there is a "subtarget" which has a bunch of options or whatever
<whitequark[cis]>
the split is all wrong
<whitequark[cis]>
instead, there needs to be an initialization stage (literally represented by __init__ methods) where you take an object representing an abstract pin and give it to e.g. an SPIControllerXyz where Xyz is some term we invent
<whitequark[cis]>
also some sort of context object I guess
<whitequark[cis]>
if SPIControllerXyz needs to add some gateware, it asks the context object to do things such as: give it a gateware-to-software or software-to-gateware channel (it gets an Amaranth stream plus an asyncio something); give it a configuration/status register; give it a LED. the SPIControllerApplet class itself would only have the UI related stuff contained in it, like which arguments should be exposed to the user, how to talk to the
<whitequark[cis]>
terminal, whatever
<whitequark[cis]>
so add_*_arguments plus interact
<joshua_>
whitequark[cis], I have some unpleasant stuff I need to do now for work, but after I finish the unpleasant stuff, I'll take a pass on your comments as a reward for myself