<Stevetronics>
Hi all, extremely dumb question: What's the correct way to use the Connectors object associated with a platform (in my case, a TinyFPGA BX) to get a handle to a GPIO pin? I just want to spit a signal out so I can see it with my scope, but I'm struggling to find the right way to traverse the Connectors object to get what I need. I was able to hack
<Stevetronics>
my way around it by creating a Resource tied to the pin I need with a Subsignal, but that doesn't feel like the right approach. I haven't been able to find where the Connector class is defined in amaranth or amaranth-boards so I'm not quite sure what the best approach is just from running dir(connector) on the object in the TinyFPGABXPlatform
<tpw_rules>
each elaborate method gets a platform object, and you call request on it with the name of a connector
<tpw_rules>
iirc
<tpw_rules>
or the name of a resource
<tpw_rules>
i don't recall off the top of my head what a Connector object is?
<tpw_rules>
i think resources contain signals, which get pointed at a connector
<Stevetronics>
That's what I am trying to figure out - it feels like I should be able to do `platform.request("gpio", 15)` to get the 15th element in the GPIO connector, which in this case points at pad D9
<Stevetronics>
Oh, that's a very helpful link - thank you!
<Stevetronics>
So it seems like the correct approach is to create a resource with the pin(s) I want, and add it to the platform before I build it
<Stevetronics>
Via something like `p15 = [Resource("Pin15", 0, Subsignal("p15", PinsN("D9", dir="o"), Attrs(IO_STANDARD="SB_LVCMOS33")))]`
<tpw_rules>
yes i think so
<tpw_rules>
or instead of pins you can use connectors which have pins
<Stevetronics>
Ah, gotcha - Add the connector in the same way, then access its pins by connector.mapping['pin_number']
<Stevetronics>
Thanks!
<tpw_rules>
no, do you see the conn= attribute on line 175?
<tpw_rules>
instead of a Pins referring to "physical" name like D9
<tpw_rules>
they can refer to a pin number or name on a connector
<tpw_rules>
which has physical pins
<tpw_rules>
whether the extra indirection is useful, i leave up to you
<Stevetronics>
Yep, I see it. Thanks - bonehead reading mistake.
<Stevetronics>
Super helpful - thanks, tpw.
cr1901_ has joined #amaranth-lang
cr1901 has quit [Ping timeout: 252 seconds]
cr1901_ is now known as cr1901
peeps[zen] has quit [Quit: Connection reset by peep]