Using GPIO Bundle as input & output

username
Posts: 477
Joined: Thu May 03, 2018 1:18 pm

Using GPIO Bundle as input & output

Postby username » Tue Jun 28, 2022 1:02 pm

I have a OLED wired up in 8-bit parallel mode using GPIO Bundle. Work just fine. Setup shown here.

Code: Select all

// https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/dedic_gpio.html#dedicated-gpio
const int bundleA_gpios[] = {OLED_D0,OLED_D1,OLED_D2,OLED_D3,OLED_D4,OLED_D5,OLED_D6,OLED_D7};

gpio_config_t io_conf = {
    .mode = GPIO_MODE_OUTPUT,
};

// Create bundleA, output only
dedic_gpio_bundle_handle_t bundleA = NULL;
dedic_gpio_bundle_config_t bundleA_config = {
    .gpio_array = bundleA_gpios,
    .array_size = sizeof(bundleA_gpios) / sizeof(bundleA_gpios[0]),
    .flags = {
        .out_en = 1,
    },
};
I now need to read from the OLED. But cannot figure out exactly how that is done.
I see there is another option for .mode = GPIO_MODE_INPUT_OUTPUT, So that is confusing me because there is not the same for .flags. The options there are:
unsigned int in_en: 1; /*!< Enable input */
unsigned int in_invert: 1; /*!< Invert input signal */
unsigned int out_en: 1; /*!< Enable output */
unsigned int out_invert: 1; /*!< Invert output signal */

Just guessing here, when I want to write I use the above and dedic_gpio_new_bundle(&bundleA_config, &bundleA));
When I want to read, I first delete it by using dedic_gpio_del_bundle(dedic_gpio_bundle_handle_t bundle);
then create a new bundle with the above but with input settings, then dedic_gpio_new_bundle(...);

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 97 guests