Skip to content

Commit 61af0fc

Browse files
committed
spi_slave_api.c: Allow to use GPIO 32 and 33 for interface signals.
Using consistently the IDF API instead of direct port access. There is a small performace drop compared to direct port access for setting the pin, but that can be accepted in favoer of consistence. GPIO33 for instance is used by Adafruit and NINA modules for the handshake signal, and these modules cannot be rewired. Signed-off-by: robert-hh <[email protected]>
1 parent 8dc9280 commit 61af0fc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

esp_hosted_fg/esp/esp_driver/network_adapter/main/spi_slave_api.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ static const char TAG[] = "SPI_DRIVER";
143143

144144
#endif
145145

146-
#define GPIO_MASK_DATA_READY (1 << CONFIG_ESP_SPI_GPIO_DATA_READY)
147-
#define GPIO_MASK_HANDSHAKE (1 << CONFIG_ESP_SPI_GPIO_HANDSHAKE)
146+
#define GPIO_MASK_DATA_READY (1ull << CONFIG_ESP_SPI_GPIO_DATA_READY)
147+
#define GPIO_MASK_HANDSHAKE (1ull << CONFIG_ESP_SPI_GPIO_HANDSHAKE)
148148

149149

150150
/* SPI internal configs */
@@ -217,22 +217,22 @@ static inline void spi_trans_free(spi_slave_transaction_t *trans)
217217

218218
static inline void set_handshake_gpio(void)
219219
{
220-
WRITE_PERI_REG(GPIO_OUT_W1TS_REG, GPIO_MASK_HANDSHAKE);
220+
gpio_set_level(CONFIG_ESP_SPI_GPIO_HANDSHAKE, 1);
221221
}
222222

223223
static inline void reset_handshake_gpio(void)
224224
{
225-
WRITE_PERI_REG(GPIO_OUT_W1TC_REG, GPIO_MASK_HANDSHAKE);
225+
gpio_set_level(CONFIG_ESP_SPI_GPIO_HANDSHAKE, 0);
226226
}
227227

228228
static inline void set_dataready_gpio(void)
229229
{
230-
WRITE_PERI_REG(GPIO_OUT_W1TS_REG, GPIO_MASK_DATA_READY);
230+
gpio_set_level(CONFIG_ESP_SPI_GPIO_DATA_READY, 1);
231231
}
232232

233233
static inline void reset_dataready_gpio(void)
234234
{
235-
WRITE_PERI_REG(GPIO_OUT_W1TC_REG, GPIO_MASK_DATA_READY);
235+
gpio_set_level(CONFIG_ESP_SPI_GPIO_DATA_READY, 0);
236236
}
237237

238238
interface_context_t *interface_insert_driver(int (*event_handler)(uint8_t val))

0 commit comments

Comments
 (0)