Tizen Native API
5.0
|
The UART API provides functions to control UART peripherals connected to the IoT device.
#include <peripheral_io.h>
This UART API provides functions to control UART peripherals connected to the IoT device.
This API is related with the following feature:
It is recommended to use features in your application for reliability.
You can check if a IoT device supports the related features for this API
by using System Information, and control your application's actions accordingly.
To ensure your application is only running on the IoT device with specific features,
please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Functions | |
int | peripheral_uart_open (int port, peripheral_uart_h *uart) |
Opens the UART slave device. | |
int | peripheral_uart_close (peripheral_uart_h uart) |
Closes the UART slave device. | |
int | peripheral_uart_set_baud_rate (peripheral_uart_h uart, peripheral_uart_baud_rate_e baud) |
Sets baud rate of the UART slave device. | |
int | peripheral_uart_set_byte_size (peripheral_uart_h uart, peripheral_uart_byte_size_e byte_size) |
Sets byte size of the UART slave device. | |
int | peripheral_uart_set_parity (peripheral_uart_h uart, peripheral_uart_parity_e parity) |
Sets parity bit of the UART slave device. | |
int | peripheral_uart_set_stop_bits (peripheral_uart_h uart, peripheral_uart_stop_bits_e stop_bits) |
Sets stop bits of the UART slave device. | |
int | peripheral_uart_set_flow_control (peripheral_uart_h uart, peripheral_uart_software_flow_control_e sw_flow_control, peripheral_uart_hardware_flow_control_e hw_flow_control) |
Sets flow control of the UART slave device. | |
int | peripheral_uart_read (peripheral_uart_h uart, uint8_t *data, uint32_t length) |
Reads data from the UART slave device. | |
int | peripheral_uart_write (peripheral_uart_h uart, uint8_t *data, uint32_t length) |
Writes data to the UART slave device. | |
Typedefs | |
typedef struct _peripheral_uart_s * | peripheral_uart_h |
The handle to the UART peripherals. |
typedef struct _peripheral_uart_s* peripheral_uart_h |
The handle to the UART peripherals.
Enumeration for baud rate.
int peripheral_uart_close | ( | peripheral_uart_h | uart | ) |
Closes the UART slave device.
[in] | uart | The UART handle |
PERIPHERAL_ERROR_NONE | Successful |
PERIPHERAL_ERROR_PERMISSION_DENIED | Permission denied |
PERIPHERAL_ERROR_INVALID_PARAMETER | Invalid parameter |
PERIPHERAL_ERROR_NOT_SUPPORTED | Not supported |
PERIPHERAL_ERROR_UNKNOWN | Unknown internal error |
int peripheral_uart_open | ( | int | port, |
peripheral_uart_h * | uart | ||
) |
Opens the UART slave device.
[in] | port | The UART port number that the slave device is connected |
[out] | uart | The UART handle is created on success |
PERIPHERAL_ERROR_NONE | Successful |
PERIPHERAL_ERROR_IO_ERROR | I/O operation failed |
PERIPHERAL_ERROR_NO_DEVICE | Device does not exist or is removed |
PERIPHERAL_ERROR_OUT_OF_MEMORY | Memory allocation failed |
PERIPHERAL_ERROR_PERMISSION_DENIED | Permission denied |
PERIPHERAL_ERROR_RESOURCE_BUSY | Device is in use |
PERIPHERAL_ERROR_INVALID_PARAMETER | Invalid parameter |
PERIPHERAL_ERROR_NOT_SUPPORTED | Not supported |
PERIPHERAL_ERROR_UNKNOWN | Unknown internal error |
int peripheral_uart_read | ( | peripheral_uart_h | uart, |
uint8_t * | data, | ||
uint32_t | length | ||
) |
Reads data from the UART slave device.
[in] | uart | The UART handle |
[out] | data | The buffer to read |
[out] | length | The size of buffer (in bytes) |
PERIPHERAL_ERROR_NONE | Successful |
PERIPHERAL_ERROR_IO_ERROR | I/O operation failed |
PERIPHERAL_ERROR_TRY_AGAIN | Try again |
PERIPHERAL_ERROR_PERMISSION_DENIED | Permission denied |
PERIPHERAL_ERROR_INVALID_PARAMETER | Invalid parameter |
PERIPHERAL_ERROR_NOT_SUPPORTED | Not supported |
PERIPHERAL_ERROR_UNKNOWN | Unknown internal error |
int peripheral_uart_set_baud_rate | ( | peripheral_uart_h | uart, |
peripheral_uart_baud_rate_e | baud | ||
) |
Sets baud rate of the UART slave device.
[in] | uart | The UART handle |
[in] | baud | Baud rate of the UART slave device |
PERIPHERAL_ERROR_NONE | Successful |
PERIPHERAL_ERROR_IO_ERROR | I/O operation failed |
PERIPHERAL_ERROR_NO_DEVICE | Device does not exist or is removed |
PERIPHERAL_ERROR_PERMISSION_DENIED | Permission denied |
PERIPHERAL_ERROR_INVALID_PARAMETER | Invalid parameter |
PERIPHERAL_ERROR_NOT_SUPPORTED | Not supported |
PERIPHERAL_ERROR_UNKNOWN | Unknown internal error |
int peripheral_uart_set_byte_size | ( | peripheral_uart_h | uart, |
peripheral_uart_byte_size_e | byte_size | ||
) |
Sets byte size of the UART slave device.
[in] | uart | The UART handle |
[in] | byte_size | Byte size of the UART slave device |
PERIPHERAL_ERROR_NONE | Successful |
PERIPHERAL_ERROR_IO_ERROR | I/O operation failed |
PERIPHERAL_ERROR_NO_DEVICE | Device does not exist or is removed |
PERIPHERAL_ERROR_PERMISSION_DENIED | Permission denied |
PERIPHERAL_ERROR_INVALID_PARAMETER | Invalid parameter |
PERIPHERAL_ERROR_NOT_SUPPORTED | Not supported |
PERIPHERAL_ERROR_UNKNOWN | Unknown internal error |
int peripheral_uart_set_flow_control | ( | peripheral_uart_h | uart, |
peripheral_uart_software_flow_control_e | sw_flow_control, | ||
peripheral_uart_hardware_flow_control_e | hw_flow_control | ||
) |
Sets flow control of the UART slave device.
[in] | uart | The UART handle |
[in] | sw_flow_control | Software flow control (Turns a transmitter on or off) |
[in] | hw_flow_control | Hardware flow control (Turns "Request to Send/Clear to Send" on or off) |
PERIPHERAL_ERROR_NONE | Successful |
PERIPHERAL_ERROR_IO_ERROR | I/O operation failed |
PERIPHERAL_ERROR_NO_DEVICE | Device does not exist or is removed |
PERIPHERAL_ERROR_PERMISSION_DENIED | Permission denied |
PERIPHERAL_ERROR_INVALID_PARAMETER | Invalid parameter |
PERIPHERAL_ERROR_NOT_SUPPORTED | Not supported |
PERIPHERAL_ERROR_UNKNOWN | Unknown internal error |
int peripheral_uart_set_parity | ( | peripheral_uart_h | uart, |
peripheral_uart_parity_e | parity | ||
) |
Sets parity bit of the UART slave device.
[in] | uart | The UART handle |
[in] | parity | Parity bit of the UART slave device |
PERIPHERAL_ERROR_NONE | Successful |
PERIPHERAL_ERROR_IO_ERROR | I/O operation failed |
PERIPHERAL_ERROR_NO_DEVICE | Device does not exist or is removed |
PERIPHERAL_ERROR_PERMISSION_DENIED | Permission denied |
PERIPHERAL_ERROR_INVALID_PARAMETER | Invalid parameter |
PERIPHERAL_ERROR_NOT_SUPPORTED | Not supported |
PERIPHERAL_ERROR_UNKNOWN | Unknown internal error |
int peripheral_uart_set_stop_bits | ( | peripheral_uart_h | uart, |
peripheral_uart_stop_bits_e | stop_bits | ||
) |
Sets stop bits of the UART slave device.
[in] | uart | The UART handle |
[in] | stop_bits | Stop bits of the UART slave device |
PERIPHERAL_ERROR_NONE | Successful |
PERIPHERAL_ERROR_IO_ERROR | I/O operation failed |
PERIPHERAL_ERROR_NO_DEVICE | Device does not exist or is removed |
PERIPHERAL_ERROR_PERMISSION_DENIED | Permission denied |
PERIPHERAL_ERROR_INVALID_PARAMETER | Invalid parameter |
PERIPHERAL_ERROR_NOT_SUPPORTED | Not supported |
PERIPHERAL_ERROR_UNKNOWN | Unknown internal error |
int peripheral_uart_write | ( | peripheral_uart_h | uart, |
uint8_t * | data, | ||
uint32_t | length | ||
) |
Writes data to the UART slave device.
[in] | uart | The UART handle |
[in] | data | The buffer to write |
[in] | length | The size of buffer (in bytes) |
PERIPHERAL_ERROR_NONE | Successful |
PERIPHERAL_ERROR_IO_ERROR | I/O operation failed |
PERIPHERAL_ERROR_TRY_AGAIN | Try again |
PERIPHERAL_ERROR_PERMISSION_DENIED | Permission denied |
PERIPHERAL_ERROR_INVALID_PARAMETER | Invalid parameter |
PERIPHERAL_ERROR_NOT_SUPPORTED | Not supported |
PERIPHERAL_ERROR_UNKNOWN | Unknown internal error |