NCS v3.0.0 async SPI slave: How to get pin numbers from .overlay to C file for SPI slave configuration?

Working on the nRF52833DK board and based off the nrfx_spim_spis advanced non-blocking example sample.  I've already converted the SPI master to use the Zephyr driver instead of using the NRFX driver directly.  (My understanding is the NRFX driver is still used by the Zephyr SPI driver under the covers.)  Unfortunately I cannot convert the SPI slave to use the Zephyr driver because the Zephyr driver does not support asynchronous SPI slave, and I want the asynchronous feature.  So I'm stuck using the NRFX driver for SPI slave.

I'm trying to do things "properly" regarding Zephyr and the devicetree, so I want to define the pins in the .overlay file since I will eventually want this firmware to run on multiple boards (each defining their own pin configuration via a .overlay or the base .dts).  Thus I need the NRFX SPI slave driver to get the SPI slave pin configuration from the devicetree directly OR my C code needs a way to pull the pin settings from the devicetree.

Unfortunately, even though the nrfx_spim_spis advanced non-blocking example DOES define pins in the .overlay files, it does NOT actually use those in the C file.  Instead it pulls the pin definitions from common/nrfx_example.h via a series of "LOOPBACK_PIN_xxx" defines, which defeats the purpose of having a devicetree specify pin configurations.  (This would be an example of not doing things "properly" regarding Zephyr and NCS.)

My question is this:  For the NRFX SPI slave, using NCS v3.0.0 (or later if needed), how do I define the SPI slave pins in the .overlay so they can be used for NRFX SPI slave configuration in the C file?  And how do I access them in the C file?

Or an even shorter and more generic version of the question:  How do I define pin numbers in a .overlay and then get those pin numbers in a C file?

For reference, following the advanced non-blocking example I currently have the pins defined like this in the .overlay:

&pinctrl {
    spis_default: spis_default {
        group1 {
            psels = <NRF_PSEL(SPIS_SCK, 0, 29)>,
                    <NRF_PSEL(SPIS_MOSI, 0, 31)>,
                    <NRF_PSEL(SPIS_MISO, 0, 30)>,
                    <NRF_PSEL(SPIS_CSN, 0, 27)>;
        };
    };
    spis_sleep: spis_sleep {
        group1 {
            psels = <NRF_PSEL(SPIS_SCK, 0, 29)>,
                    <NRF_PSEL(SPIS_MOSI, 0, 31)>,
                    <NRF_PSEL(SPIS_MISO, 0, 30)>,
                    <NRF_PSEL(SPIS_CSN, 0, 27)>;
            low-power-enable;
        };
    };
};

&spi2 {
    status = "okay";
    compatible = "nordic,nrf-spis";
    pinctrl-names = "default","sleep";
    pinctrl-0 = <&spis_default>;
    pinctrl-1 = <&spis_sleep>;
    def-char = <0xFF>;
};

Unfortunately there does not appear to be an easy way to get those values from the pinctrl into the C code.

Related