does esp32 support bi-direction gpio?
Posted: Tue Nov 14, 2017 6:24 am
Use ESP32 to access A7108, a 433M transceiver, which requires 3-line SPI interface, through spec, the data pin is bi-direction,
I configured GPIO21 as GPIO_MODE_INPUT_OUTPUT mode:
#define GPIO_DATA 21
#define GPIO_IO_PIN_SEL (((uint64_t)1)<<GPIO_DATA)
...
io_conf.pin_bit_mask = GPIO_IO_PIN_SEL;
//set as input&output mode
io_conf.mode = GPIO_MODE_INPUT_OUTPUT;
//disable pull-down mode, external pull up
io_conf.pull_down_en = 0;
//enable pull-up mode
io_conf.pull_up_en = 0;
gpio_config(&io_conf);
but the value read by gpio_get_level is the last value set by gpio_set_level, not the register value. Not sure if esp32 really support bi-direction IO access.
I configured GPIO21 as GPIO_MODE_INPUT_OUTPUT mode:
#define GPIO_DATA 21
#define GPIO_IO_PIN_SEL (((uint64_t)1)<<GPIO_DATA)
...
io_conf.pin_bit_mask = GPIO_IO_PIN_SEL;
//set as input&output mode
io_conf.mode = GPIO_MODE_INPUT_OUTPUT;
//disable pull-down mode, external pull up
io_conf.pull_down_en = 0;
//enable pull-up mode
io_conf.pull_up_en = 0;
gpio_config(&io_conf);
but the value read by gpio_get_level is the last value set by gpio_set_level, not the register value. Not sure if esp32 really support bi-direction IO access.