Line data Source code
1 1 : /* 2 : * Copyright (c) 2023 Elektronikutvecklingsbyrån EUB AB 3 : * SPDX-License-Identifier: Apache-2.0 4 : */ 5 : 6 : /** 7 : * @file 8 : * @brief Pmod GPIO nexus signal index definitions 9 : * 10 : * Defines meant to be used in conjunction with the "digilent,pmod" 11 : * GPIO nexus mapping. 12 : * 13 : * Example usage: 14 : * 15 : * @code{.dts} 16 : * &spi1 { 17 : * cs-gpios = <&pmod0 PMOD_SPI_CS GPIO_ACTIVE_LOW>; 18 : * 19 : * example_device: example-dev@0 { 20 : * compatible = "vnd,spi-device"; 21 : * reg = <0>; 22 : * }; 23 : * }; 24 : * @endcode 25 : */ 26 : 27 : #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_DIGILENT_PMOD_H_ 28 : #define ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_DIGILENT_PMOD_H_ 29 : 30 : /** 31 : * For reference see the Pmod interface specification: 32 : * https://digilent.com/reference/_media/reference/pmod/pmod-interface-specification-1_2_0.pdf 33 : */ 34 : 35 : /* GPIO */ 36 : 37 : /** 38 : * @brief IO[n] signal on a Pmod GPIO nexus node following 39 : * Pmod Interface Type 1 or 1A (GPIO or expanded GPIO) 40 : * 41 : * The Pmod GPIO nexus maps pin indexes 0..7 to IO1..IO8. 42 : */ 43 1 : #define PMOD_IO(n) ((n) - 1) 44 : 45 : /* SPI */ 46 : 47 : /** 48 : * @brief SPI CS signal index on a Pmod GPIO nexus node. 49 : * Used with Pmod Interface Type 2 (SPI) peripherals. 50 : */ 51 1 : #define PMOD_SPI_CS PMOD_IO(1) 52 : 53 : /** 54 : * @brief SPI MOSI signal index on a Pmod GPIO nexus node. 55 : * Used with Pmod Interface Type 2 (SPI) peripherals. 56 : */ 57 1 : #define PMOD_SPI_MOSI PMOD_IO(2) 58 : 59 : /** 60 : * @brief SPI MISO signal index on a Pmod GPIO nexus node. 61 : * Used with Pmod Interface Type 2 (SPI) peripherals. 62 : */ 63 1 : #define PMOD_SPI_MISO PMOD_IO(3) 64 : 65 : /** 66 : * @brief SPI SCK signal index on a Pmod GPIO nexus node. 67 : * Used with Pmod Interface Type 2 (SPI) peripherals. 68 : */ 69 1 : #define PMOD_SPI_SCK PMOD_IO(4) 70 : 71 : /* Expanded SPI */ 72 : 73 : /** 74 : * @brief SPI CS signal index on a Pmod GPIO nexus node. 75 : * Used with Pmod Interface Type 2A (expanded SPI) peripherals. 76 : */ 77 1 : #define PMOD_EXP_SPI_CS PMOD_IO(1) 78 : 79 : /** 80 : * @brief SPI MOSI signal index on a Pmod GPIO nexus node. 81 : * Used with Pmod Interface Type 2A (expanded SPI) peripherals. 82 : */ 83 1 : #define PMOD_EXP_SPI_MOSI PMOD_IO(2) 84 : 85 : /** 86 : * @brief SPI MISO signal index on a Pmod GPIO nexus node. 87 : * Used with Pmod Interface Type 2A (expanded SPI) peripherals. 88 : */ 89 1 : #define PMOD_EXP_SPI_MISO PMOD_IO(3) 90 : 91 : /** 92 : * @brief SPI SCK signal index on a Pmod GPIO nexus node. 93 : * Used with Pmod Interface Type 2A (expanded SPI) peripherals. 94 : */ 95 1 : #define PMOD_EXP_SPI_SCK PMOD_IO(4) 96 : 97 : /** 98 : * @brief INT alternate signal index on a Pmod GPIO nexus node. 99 : * Used with Pmod Interface Type 2A (expanded SPI) peripherals. 100 : */ 101 1 : #define PMOD_EXP_SPI_INT PMOD_IO(5) 102 : 103 : /** 104 : * @brief RESET alternate signal index on a Pmod GPIO nexus node. 105 : * Used with Pmod Interface Type 2A (expanded SPI) peripherals. 106 : */ 107 1 : #define PMOD_EXP_SPI_RESET PMOD_IO(6) 108 : 109 : /** 110 : * @brief SPI CS2 alternate signal index on a Pmod GPIO nexus node. 111 : * Used with Pmod Interface Type 2A (expanded SPI) peripherals. 112 : */ 113 1 : #define PMOD_EXP_SPI_CS2 PMOD_IO(7) 114 : 115 : /** 116 : * @brief SPI CS3 alternate signal index on a Pmod GPIO nexus node. 117 : * Used with Pmod Interface Type 2A (expanded SPI) peripherals. 118 : */ 119 1 : #define PMOD_EXP_SPI_CS3 PMOD_IO(8) 120 : 121 : /* Expanded UART */ 122 : 123 : /** 124 : * @brief INT alternate signal index on a Pmod GPIO nexus node. 125 : * Used with Pmod Interface Type 3A (expanded UART) peripherals. 126 : */ 127 1 : #define PMOD_EXP_UART_INT PMOD_IO(5) 128 : 129 : /** 130 : * @brief RESET alternate signal index on a Pmod GPIO nexus node. 131 : * Used with Pmod Interface Type 3A (expanded UART) peripherals. 132 : */ 133 1 : #define PMOD_EXP_UART_RESET PMOD_IO(6) 134 : 135 : /* H-bridge */ 136 : 137 : /** 138 : * @brief DIR signal index on a Pmod GPIO nexus node. 139 : * Used with Pmod Interface Type 4 (H-bridge) peripherals. 140 : */ 141 1 : #define PMOD_HBRIDGE_DIR PMOD_IO(1) 142 : 143 : /** 144 : * @brief EN signal index on a Pmod GPIO nexus node. 145 : * Used with Pmod Interface Type 4 (H-bridge) peripherals. 146 : */ 147 1 : #define PMOD_HBRIDGE_EN PMOD_IO(2) 148 : 149 : /* Dual H-bridge */ 150 : 151 : /** 152 : * @brief DIR1 signal index on a Pmod GPIO nexus node. 153 : * Used with Pmod Interface Type 5 (dual H-bridge) peripherals. 154 : */ 155 1 : #define PMOD_DUAL_HBRIDGE_DIR1 PMOD_IO(1) 156 : 157 : /** 158 : * @brief EN1 signal index on a Pmod GPIO nexus node. 159 : * Used with Pmod Interface Type 5 (dual H-bridge) peripherals. 160 : */ 161 1 : #define PMOD_DUAL_HBRIDGE_EN1 PMOD_IO(2) 162 : 163 : /** 164 : * @brief DIR2 signal index on a Pmod GPIO nexus node. 165 : * Used with Pmod Interface Type 5 (dual H-bridge) peripherals. 166 : */ 167 1 : #define PMOD_DUAL_HBRIDGE_DIR2 PMOD_IO(3) 168 : 169 : /** 170 : * @brief EN2 signal index on a Pmod GPIO nexus node. 171 : * Used with Pmod Interface Type 5 (dual H-bridge) peripherals. 172 : */ 173 1 : #define PMOD_DUAL_HBRIDGE_EN2 PMOD_IO(4) 174 : 175 : /* Expanded dual H-bridge */ 176 : 177 : /** 178 : * @brief DIR1 signal index on a Pmod GPIO nexus node. 179 : * Used with Pmod Interface Type 5A (expanded dual H-bridge) peripherals. 180 : */ 181 1 : #define PMOD_EXP_DUAL_HBRIDGE_DIR1 PMOD_IO(1) 182 : 183 : /** 184 : * @brief EN1 signal index on a Pmod GPIO nexus node. 185 : * Used with Pmod Interface Type 5A (expanded dual H-bridge) peripherals. 186 : */ 187 1 : #define PMOD_EXP_DUAL_HBRIDGE_EN1 PMOD_IO(2) 188 : 189 : /** 190 : * @brief DIR2 signal index on a Pmod GPIO nexus node. 191 : * Used with Pmod Interface Type 5A (expanded dual H-bridge) peripherals. 192 : */ 193 1 : #define PMOD_EXP_DUAL_HBRIDGE_DIR2 PMOD_IO(5) 194 : 195 : /** 196 : * @brief EN2 signal index on a Pmod GPIO nexus node. 197 : * Used with Pmod Interface Type 5A (expanded dual H-bridge) peripherals. 198 : */ 199 1 : #define PMOD_EXP_DUAL_HBRIDGE_EN2 PMOD_IO(6) 200 : 201 : /* I2C */ 202 : 203 : /** 204 : * @brief INT signal index on a Pmod GPIO nexus node. 205 : * Used with Pmod Interface Type 6 (I2C) peripherals. 206 : */ 207 1 : #define PMOD_I2C_INT PMOD_IO(1) 208 : 209 : /** 210 : * @brief RESET signal index on a Pmod GPIO nexus node. 211 : * Used with Pmod Interface Type 6 (I2C) peripherals. 212 : */ 213 1 : #define PMOD_I2C_RESET PMOD_IO(2) 214 : 215 : /** 216 : * @brief SCL signal index on a Pmod GPIO nexus node. 217 : * Used with Pmod Interface Type 6 (I2C) peripherals. 218 : */ 219 1 : #define PMOD_I2C_SCL PMOD_IO(3) 220 : 221 : /** 222 : * @brief SDA signal index on a Pmod GPIO nexus node. 223 : * Used with Pmod Interface Type 6 (I2C) peripherals. 224 : */ 225 1 : #define PMOD_I2C_SDA PMOD_IO(4) 226 : 227 : #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_DIGILENT_PMOD_H_ */