I initially created and uploaded this library on github for my own backup and as a reference for my co-workers. Lately, to my surprise, this library has been getting a lot of traction. So I've decided to add GNU GPLv3 so anyone can officially use this in their own projects, public or commercial.
This is a motivator for me, and I might just go ahead and start creating a one-stop-shop libraries for other BBB peripherals as well. Let me know if any of you specifically want me to develop something in my free time.
You can contact me at akshay.patwardhan@outlook.com
This is a simple BeagleBone Black UART library aimed at any OS that uses capemgr. This library uses termios. More information about termios can be found in its man page. You can use this wikipedia page for reference as well: https://en.wikibooks.org/wiki/Serial_Programming/termios
-
Add the files into your project.
-
Include uart.h
- Initializes a specific UART peripheral with given baudrate
- UART number to initialize.
- Valid values - 0 to 4
- UART baudrate
- Valid values - 1200, 1800, 2400, 4800, 9600, 19200, 38400 ... up to 400000
- Please refer to termios manpage for the exact values supported.
- UART_FUNCTION_SUCCESSFUL - Function completed successfully
- UART_NUMBER_INCORRECT - UART number entered is incorrect
- UART_BAUDRATE_INCORRECT - UART baudrate entered is incorrect
- UART_INCORRECT_PATH - Slots didn't open for both bone_capemgr.9 and bone_capemgr.8
- Deinitializes UART peripheral
- UART number to initialize.
- Valid values - 0 to 4
- UART_FUNCTION_SUCCESSFUL - Function completed successfully
- UART_NUMBER_INCORRECT - UART number entered is incorrect
- Write a single byte to UART
- UART number to initialize.
- Valid values - 0 to 4
- UART_FUNCTION_SUCCESSFUL - Function completed successfully
- UART_NUMBER_INCORRECT - UART number entered is incorrect
- Write a byte array to UART
- UART number to initialize.
- Valid values - 0 to 4
- Byte array to be written to UART
- UART_FUNCTION_SUCCESSFUL - Function completed successfully
- UART_NUMBER_INCORRECT - UART number entered is incorrect
- UART_FIFO_ERROR - Character array passed has exceeds Transmit FIFO size
- UART Receive FIFO is copied into the global array uartReadBufferX
- UART number to initialize.
- Valid values - 0 to 4
- UART_FUNCTION_SUCCESSFUL - Function completed successfully
- UART_NUMBER_INCORRECT - UART number entered is incorrect
- Wait till UART transmission is complete.
- UART number to initialize.
- Valid values - 0 to 4
- UART_FUNCTION_SUCCESSFUL - Function completed successfully
- UART_NUMBER_INCORRECT - UART number entered is incorrect