You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2021/07/16 22:53:12 UTC

[incubator-nuttx] branch master updated: risc-v/esp32-c3: Makes output readable and rmv unnecessary var.

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 81e881c  risc-v/esp32-c3: Makes output readable and rmv unnecessary var.
81e881c is described below

commit 81e881c8c05572cbecf9ef69882aacf41eb47447
Author: Sara Souza <sa...@espressif.com>
AuthorDate: Thu Jul 15 17:51:07 2021 -0300

    risc-v/esp32-c3: Makes output readable and rmv unnecessary var.
---
 boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_gpio.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_gpio.c b/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_gpio.c
index 6fb40b9..c5af014 100644
--- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_gpio.c
+++ b/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_gpio.c
@@ -283,7 +283,6 @@ static int gpint_enable(FAR struct gpio_dev_s *dev, bool enable)
 int esp32c3_gpio_init(void)
 {
   int i;
-  int pincount = 0;
 
 #if BOARD_NGPIOOUT > 0
   for (i = 0; i < BOARD_NGPIOOUT; i++)
@@ -293,15 +292,14 @@ int esp32c3_gpio_init(void)
       g_gpout[i].gpio.gp_pintype = GPIO_OUTPUT_PIN;
       g_gpout[i].gpio.gp_ops     = &gpout_ops;
       g_gpout[i].id              = i;
-      gpio_pin_register(&g_gpout[i].gpio, pincount);
+      gpio_pin_register(&g_gpout[i].gpio, i);
 
       /* Configure the pins that will be used as output */
 
       esp32c3_gpio_matrix_out(g_gpiooutputs[i], SIG_GPIO_OUT_IDX, 0, 0);
-      esp32c3_configgpio(g_gpiooutputs[i], OUTPUT_FUNCTION_1);
+      esp32c3_configgpio(g_gpiooutputs[i], OUTPUT_FUNCTION_1 |
+                         INPUT_FUNCTION_1);
       esp32c3_gpiowrite(g_gpiooutputs[i], 0);
-
-      pincount++;
     }
 #endif
 
@@ -313,13 +311,11 @@ int esp32c3_gpio_init(void)
       g_gpint[i].esp32c3gpio.gpio.gp_pintype = GPIO_INTERRUPT_PIN;
       g_gpint[i].esp32c3gpio.gpio.gp_ops     = &gpint_ops;
       g_gpint[i].esp32c3gpio.id              = i;
-      gpio_pin_register(&g_gpint[i].esp32c3gpio.gpio, pincount);
+      gpio_pin_register(&g_gpint[i].esp32c3gpio.gpio, i);
 
       /* Configure the pins that will be used as interrupt input */
 
       esp32c3_configgpio(g_gpiointinputs[i], INPUT_FUNCTION_1 | PULLDOWN);
-
-      pincount++;
     }
 #endif