nRF52810_preliminary_softwa.../common/common-pinctrl.dtsi

64 lines
2.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* This file is created to fulfill the requirement of a pinctrl-N
* property for nodes in the specific target overlay file.
*
* In the current implementation of samples, the specific peripheral
* driver instance is initialized at runtime with a configuration
* based on pin symbols defined in `nrfx_example.h`.
*
* To use values from specific property nodes from the device tree,
* appropriate values for the `psels` property must be provided
* instead of the dummy values defined in that file. Once done, these values
* can be accessed from the device tree through using the API implemented in
* `<zephyr/devicetree.h>` (see Zephyrs doc: Devicetree access from C/C++).
*
* Here is a sample of extracting node `psels` values to initialize a peripheral
* driver instance with a configuration based on those values:
*
* #define SPI_NODE DT_NODELABEL(spi1)
* #define SPI_PINCTRL_NODE DT_CHILD(DT_PINCTRL_0(SPI_NODE, 0), group1)
* #define SCK_PIN (DT_PROP_BY_IDX(SPI_PINCTRL_NODE, psels, 0) & 0x3F)
* #define MISO_PIN (DT_PROP_BY_IDX(SPI_PINCTRL_NODE, psels, 1) & 0x3F)
* #define MOSI_PIN (DT_PROP_BY_IDX(SPI_PINCTRL_NODE, psels, 2) & 0x3F)
*/
&pinctrl {
spi_dummy: spi_dummy {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 0)>,
<NRF_PSEL(SPIM_MISO, 0, 0)>,
<NRF_PSEL(SPIM_MOSI, 0, 0)>;
};
};
spi_master_default: spi_master_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 0)>,
<NRF_PSEL(SPIM_MISO, 0, 0)>,
<NRF_PSEL(SPIM_MOSI, 0, 0)>;
};
};
spi_slave_dummy: spi_slave_dummy {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 0)>,
<NRF_PSEL(SPIM_MISO, 0, 0)>,
<NRF_PSEL(SPIM_MOSI, 0, 0)>;
};
};
i2c_master_dummy: i2c_master_dummy {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 0)>,
<NRF_PSEL(TWIM_SCL, 0, 0)>;
};
};
i2c_slave_dummy: i2c_slave_dummy {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 0)>,
<NRF_PSEL(TWIM_SCL, 0, 0)>;
};
};
};