Skip to content
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

[Feature Request] Can you add uart_stop () and uart_start() functions to serial drivers? #24320

Open
1 of 4 tasks
KeyMagicHorse opened this issue Aug 24, 2024 · 0 comments
Open
1 of 4 tasks

Comments

@KeyMagicHorse
Copy link

KeyMagicHorse commented Aug 24, 2024

Feature Request Type

  • Core functionality
  • Add-on hardware support (eg. audio, RGB, OLED screen, etc.)
  • Alteration (enhancement/optimization) of existing feature(s)
  • New behavior

Description

I've already modified it in my personal branch (uart_sio.c/uart_serial.c in chibios), what should I do if I need to merge?

static bool is_initialised = false;
void uart_init(uint32_t baud) {

    if (is_initialised) {
        return;
    }
    is_initialised = true;

#if defined(MCU_KINETIS)
    serialConfig.sc_speed = baud;
#else
    serialConfig.speed = baud;
#endif

#if defined(USE_GPIOV1)
    palSetLineMode(UART_TX_PIN, UART_TX_PAL_MODE);
    palSetLineMode(UART_RX_PIN, UART_RX_PAL_MODE);
#else
    palSetLineMode(UART_TX_PIN, PAL_MODE_ALTERNATE(UART_TX_PAL_MODE) | PAL_OUTPUT_TYPE_PUSHPULL | PAL_OUTPUT_SPEED_HIGHEST);
    palSetLineMode(UART_RX_PIN, PAL_MODE_ALTERNATE(UART_RX_PAL_MODE) | PAL_OUTPUT_TYPE_PUSHPULL | PAL_OUTPUT_SPEED_HIGHEST);
#endif

    sdStart(&UART_DRIVER, &serialConfig);
}
void uart_stop(void)
{
    sdStop(&UART_DRIVER);
    is_initialised = false;
}
void uart_start(void)
{
#if defined(MCU_KINETIS)
    uint32_t baud = serialConfig.sc_speed;
#else
    uint32_t baud = serialConfig.speed ;
#endif
    uart_init(baud);
}
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

1 participant