Skip to content

Compiler Warning on uartSetPins() in esp32-hal-uart.c #9047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
caipifrosch opened this issue Dec 29, 2023 · 3 comments
Closed
1 task done

Compiler Warning on uartSetPins() in esp32-hal-uart.c #9047

caipifrosch opened this issue Dec 29, 2023 · 3 comments
Assignees

Comments

@caipifrosch
Copy link

Board

any

Device Description

any

Hardware Configuration

n/a

Version

v2.0.14

IDE Name

PlatformIO

Operating System

Windows 11

Flash frequency

any

PSRAM enabled

no

Upload speed

any

Description

bool uartSetPins() does not return value and generates compiler warning.

Seems to be ralated to line 153 in esp32-hal-uart.c

C:/Users/andre/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-uart.c: In function 'uartSetPins':
C:/Users/andre/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-uart.c:153:9: warning: 'return' with no value, in function returning non-void
return;
^~~~~~
C:/Users/andre/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-uart.c:149:6: note: declared here
bool uartSetPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin)
^~~~~~~~~~~

Sketch

// Valid pin UART_PIN_NO_CHANGE is defined to (-1)
// Negative Pin Number will keep it unmodified, thus this function can set individual pins
bool uartSetPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin)
{
    if(uart_num >= SOC_UART_NUM) {
        log_e("Serial number is invalid, please use numers from 0 to %u", SOC_UART_NUM - 1);
        return;
    }

    // IDF uart_set_pin() will issue necessary Error Message and take care of all GPIO Number validation.
    bool retCode = uart_set_pin(uart_num, txPin, rxPin, rtsPin, ctsPin) == ESP_OK; 
    return retCode;
}

Debug Message

C:/Users/andre/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-uart.c: In function 'uartSetPins':
C:/Users/andre/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-uart.c:153:9: warning: 'return' with no value, in function returning non-void
         return;
         ^~~~~~
C:/Users/andre/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-uart.c:149:6: note: declared here
 bool uartSetPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin)
      ^~~~~~~~~~~

Other Steps to Reproduce

none

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@caipifrosch caipifrosch added the Status: Awaiting triage Issue is waiting for triage label Dec 29, 2023
@lbernstone
Copy link
Contributor

Already fixed in master

@SuGlider SuGlider self-assigned this Dec 29, 2023
@SuGlider
Copy link
Collaborator

PR #8644

@SuGlider SuGlider added Status: Solved and removed Status: Awaiting triage Issue is waiting for triage labels Dec 29, 2023
@SuGlider
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants