| 123456789101112131415161718192021222324 |
- #include "uart.h"
- #include <string.h>
- #include <stdio.h>
- int main()
- {
- uart_handle_st uart;
- memset(&uart, 0, sizeof(uart));
- uart_handle_set_device(&uart, "/dev/ttyS1");
- uart_handle_set_baudrate(&uart, 115200);
- uart_handle_set_databits(&uart, 8);
- uart_handle_set_stopbits(&uart, 1);
- uart_handle_set_parity(&uart, PARITY_NONE);
- uart_handle_set_flow_control(&uart, FLOW_CONTROL_NONE);
- uart_handle_set_block(&uart, 1);
- if(uart_handle_open(&uart) < 0)
- {
- printf("Failed to open UART\n");
- return -1;
- }
- }
|