|
hal
Hardware Abstraction Layer
|
Provides serial communication over UART2. More...
#include "uart.h"

Go to the source code of this file.
Functions | |
| hal_status_t | stm32f4_uart2_init () |
| Initialize UART channel 2. Must be called prior to using the channel. More... | |
| hal_status_t | stm32f4_uart2_deinit () |
| Deinitialize UART channel 2. More... | |
| hal_status_t | stm32f4_uart2_read (uint8_t *data, size_t len, size_t *bytes_read) |
| Read an incoming byte stream from UART channel 2. More... | |
| hal_status_t | stm32f4_uart2_write (const uint8_t *data, size_t len, size_t *bytes_written) |
| Write an outgoing byte stream to UART channel 2. More... | |
Provides serial communication over UART2.
Copyright (c) 2025 Cory McKiel. Licensed under the MIT License. See LICENSE file in the project root.
| hal_status_t stm32f4_uart2_deinit | ( | ) |
Deinitialize UART channel 2.
The channel can only be deinitialized if it has previously been initialized.
| hal_status_t stm32f4_uart2_init | ( | ) |
Initialize UART channel 2. Must be called prior to using the channel.
Initialize UART channel 2. Must be called prior to using the channel.
| hal_status_t stm32f4_uart2_read | ( | uint8_t * | data, |
| size_t | len, | ||
| size_t * | bytes_read | ||
| ) |
Read an incoming byte stream from UART channel 2.
Data is placed into the buffer in the same order it was received on the UART channel. There is no way to partition it using this API. Any processing (i.e. parsing for the start of a command) needs to happen at a higher level.
| data | A buffer to return read data to client. |
| len | The max number of bytes to read into buffer. Should not exceed buffer size. |
| bytes_read | Return the actual number of bytes that were successfully read. |
Read an incoming byte stream from UART channel 2.
| hal_status_t stm32f4_uart2_write | ( | const uint8_t * | data, |
| size_t | len, | ||
| size_t * | bytes_written | ||
| ) |
Write an outgoing byte stream to UART channel 2.
| data | A buffer filled with data to send. |
| len | The number of bytes to send. Should not exceed buffer size. |
| bytes_written | Return the actual number of bytes that were successfully written. |
Write an outgoing byte stream to UART channel 2.