1/* 2 * This file is created to fulfill the requirement of a pinctrl-N 3 * property for nodes in the specific target overlay file. 4 * 5 * In the current implementation of samples, the specific peripheral 6 * driver instance is initialized at runtime with a configuration 7 * based on pin symbols defined in `nrfx_example.h`. 8 * 9 * To use values from specific property nodes from the device tree, 10 * appropriate values for the `psels` property must be provided 11 * instead of the dummy values defined in that file. Once done, these values 12 * can be accessed from the device tree through using the API implemented in 13 * `<zephyr/devicetree.h>` (see Zephyr’s doc: Devicetree access from C/C++). 14 * 15 * Here is a sample of extracting node `psels` values to initialize a peripheral 16 * driver instance with a configuration based on those values: 17 * 18 * #define SPI_NODE DT_NODELABEL(spi1) 19 * #define SPI_PINCTRL_NODE DT_CHILD(DT_PINCTRL_0(SPI_NODE, 0), group1) 20 * #define SCK_PIN (DT_PROP_BY_IDX(SPI_PINCTRL_NODE, psels, 0) & 0x3F) 21 * #define MISO_PIN (DT_PROP_BY_IDX(SPI_PINCTRL_NODE, psels, 1) & 0x3F) 22 * #define MOSI_PIN (DT_PROP_BY_IDX(SPI_PINCTRL_NODE, psels, 2) & 0x3F) 23 */ 24 25&pinctrl { 26 spi_dummy: spi_dummy { 27 group1 { 28 psels = <NRF_PSEL(SPIM_SCK, 0, 0)>, 29 <NRF_PSEL(SPIM_MISO, 0, 0)>, 30 <NRF_PSEL(SPIM_MOSI, 0, 0)>; 31 }; 32 }; 33 34 spi_master_default: spi_master_default { 35 group1 { 36 psels = <NRF_PSEL(SPIM_SCK, 0, 0)>, 37 <NRF_PSEL(SPIM_MISO, 0, 0)>, 38 <NRF_PSEL(SPIM_MOSI, 0, 0)>; 39 }; 40 }; 41 42 spi_slave_dummy: spi_slave_dummy { 43 group1 { 44 psels = <NRF_PSEL(SPIM_SCK, 0, 0)>, 45 <NRF_PSEL(SPIM_MISO, 0, 0)>, 46 <NRF_PSEL(SPIM_MOSI, 0, 0)>; 47 }; 48 }; 49 50 i2c_master_dummy: i2c_master_dummy { 51 group1 { 52 psels = <NRF_PSEL(TWIM_SDA, 0, 0)>, 53 <NRF_PSEL(TWIM_SCL, 0, 0)>; 54 }; 55 }; 56 57 i2c_slave_dummy: i2c_slave_dummy { 58 group1 { 59 psels = <NRF_PSEL(TWIM_SDA, 0, 0)>, 60 <NRF_PSEL(TWIM_SCL, 0, 0)>; 61 }; 62 }; 63}; 64