You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/03/04 02:46:52 UTC
[incubator-nuttx] branch master updated (85620c3 -> b1b4190)
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.
from 85620c3 risc-v/esp32c3: Add more flash options to esptool.
new bc33500 risc-v/esp32c3: Allow pin to be configured as Input and Output simultaneously
new b1b4190 risc-v/esp32c3: Fix default GPIO function when no option is provided
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
arch/risc-v/src/esp32c3/esp32c3_gpio.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
[incubator-nuttx] 01/02: risc-v/esp32c3: Allow pin to be configured
as Input and Output simultaneously
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit bc335009d9653f300ac8c1228088052d5c25a6ac
Author: Gustavo Henrique Nihei <gu...@espressif.com>
AuthorDate: Tue Mar 2 11:08:32 2021 -0300
risc-v/esp32c3: Allow pin to be configured as Input and Output simultaneously
---
arch/risc-v/src/esp32c3/esp32c3_gpio.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/risc-v/src/esp32c3/esp32c3_gpio.c b/arch/risc-v/src/esp32c3/esp32c3_gpio.c
index 36e923d..3b9bdba 100644
--- a/arch/risc-v/src/esp32c3/esp32c3_gpio.c
+++ b/arch/risc-v/src/esp32c3/esp32c3_gpio.c
@@ -134,11 +134,15 @@ int esp32c3_configgpio(int pin, gpio_pinattr_t attr)
{
putreg32((1ul << pin), GPIO_ENABLE_W1TC_REG);
+ /* Input enable */
+
+ func |= FUN_IE;
+
if ((attr & PULLUP) != 0)
{
func |= FUN_PU;
}
- else if (attr & PULLDOWN)
+ else if ((attr & PULLDOWN) != 0)
{
func |= FUN_PD;
}
@@ -146,7 +150,7 @@ int esp32c3_configgpio(int pin, gpio_pinattr_t attr)
/* Handle output pins */
- else if ((attr & OUTPUT) != 0)
+ if ((attr & OUTPUT) != 0)
{
putreg32((1ul << pin), GPIO_ENABLE_W1TS_REG);
}
@@ -155,10 +159,6 @@ int esp32c3_configgpio(int pin, gpio_pinattr_t attr)
func |= (uint32_t)(2ul << FUN_DRV_S);
- /* Input enable... Required for output as well? */
-
- func |= FUN_IE;
-
/* Select the pad's function. If no function was given, consider it a
* normal input or output (i.e. function3).
*/
[incubator-nuttx] 02/02: risc-v/esp32c3: Fix default GPIO function
when no option is provided
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit b1b41908020ccea3a0a077d26bb896a5ce9ba601
Author: Gustavo Henrique Nihei <gu...@espressif.com>
AuthorDate: Tue Mar 2 11:11:49 2021 -0300
risc-v/esp32c3: Fix default GPIO function when no option is provided
---
arch/risc-v/src/esp32c3/esp32c3_gpio.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/risc-v/src/esp32c3/esp32c3_gpio.c b/arch/risc-v/src/esp32c3/esp32c3_gpio.c
index 3b9bdba..de4fc5b 100644
--- a/arch/risc-v/src/esp32c3/esp32c3_gpio.c
+++ b/arch/risc-v/src/esp32c3/esp32c3_gpio.c
@@ -159,8 +159,8 @@ int esp32c3_configgpio(int pin, gpio_pinattr_t attr)
func |= (uint32_t)(2ul << FUN_DRV_S);
- /* Select the pad's function. If no function was given, consider it a
- * normal input or output (i.e. function3).
+ /* Select the pad's function. If no function was given, consider it a
+ * normal input or output (i.e. function1).
*/
if ((attr & FUNCTION_MASK) != 0)
@@ -169,12 +169,12 @@ int esp32c3_configgpio(int pin, gpio_pinattr_t attr)
}
else
{
- func |= (uint32_t)((2 >> FUNCTION_SHIFT) << MCU_SEL_S);
+ func |= (uint32_t)(PIN_FUNC_GPIO << MCU_SEL_S);
}
if ((attr & OPEN_DRAIN) != 0)
{
- cntrl = (1 << GPIO_PIN_PAD_DRIVER_S);
+ cntrl |= (1 << GPIO_PIN_PAD_DRIVER_S);
}
/* Set the pin function to its register */