help with bundles for GPIO
Posted: Thu Jun 20, 2024 2:31 pm
Looking at useing my esp32-s3 chip with this code
I got from https://docs.espressif.com/projects/esp ... _gpio.html
My goal is to change GPIO pins 0 and 1 output levels with it. And I will also need to read the pin states equally as fast as possible. If achievable I want to also change the pin directions with the goal of speed in mind. I need to do some bitbang work and the built in functions are about 30nS a cycle. Looks like the bundling is thew way to go but this example is output only. I'm not following the example or documentation well enough to see how to allow input and output along with setting the direction of the ports ( if possible ) with this method.
I added these defines but not able to change output
Code: Select all
// configure GPIO
const int bundleA_gpios[] = {0, 1};
gpio_config_t io_conf = {
.mode = GPIO_MODE_OUTPUT,
};
for (int i = 0; i < sizeof(bundleA_gpios) / sizeof(bundleA_gpios[0]); i++) {
io_conf.pin_bit_mask = 1ULL << bundleA_gpios[i];
gpio_config(&io_conf);
}
// 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,
},
};
ESP_ERROR_CHECK(dedic_gpio_new_bundle(&bundleA_config, &bundleA));
My goal is to change GPIO pins 0 and 1 output levels with it. And I will also need to read the pin states equally as fast as possible. If achievable I want to also change the pin directions with the goal of speed in mind. I need to do some bitbang work and the built in functions are about 30nS a cycle. Looks like the bundling is thew way to go but this example is output only. I'm not following the example or documentation well enough to see how to allow input and output along with setting the direction of the ports ( if possible ) with this method.
I added these defines but not able to change output
Code: Select all
#define HIGH(dedic_io_num) __asm__ __volatile__ ("ee.set_bit_gpio_out %0" : : "I"(dedic_io_num) : );
#define LOW(dedic_io_num) __asm__ __volatile__ ("ee.clr_bit_gpio_out %0" : : "I"(dedic_io_num) : );