Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ include("${lib_path}/GlobalShare/common.cmake")
include("${lib_path}/Utils/CircularBuffer/circular-buffer-lib.cmake")
include("${lib_path}/cmake/gr-lib.cmake")

# Peripherals
include("${lib_path}/Peripherals/USART/common.cmake")

message(
STATUS
"Build type: "
Expand Down
10 changes: 10 additions & 0 deletions Lib/Peripherals/README.md
Comment thread
GabeMillikan marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Lib/Peripherals

These abstract peripheral interfaces intend on satisfying the following goals:

1. Reduce boilerplate in application code
2. Share similar APIs across different peripherals, so we can (relatively) easily swap between two
3. Support interrupt-based TX/RX so we don't need to busy-wait while transferring large packets
4. Queue outgoing and incoming messages in a [CircularBuffer](/Lib/Utils/CircularBuffer/README.md)

See each subdirectory for specific details about that peripheral.
10 changes: 10 additions & 0 deletions Lib/Peripherals/USART/common.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
add_library(PERIPHERAL_USART_LIB INTERFACE)

target_sources(PERIPHERAL_USART_LIB INTERFACE ${CMAKE_CURRENT_LIST_DIR}/usart.c)

# Make headers accessible as #include "Peripherals/USART/usart.h"
target_include_directories(
PERIPHERAL_USART_LIB
INTERFACE
${CMAKE_CURRENT_LIST_DIR}/../..
)
6 changes: 6 additions & 0 deletions Lib/Peripherals/USART/usart.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "usart.h"

void usart_example(void)
{
// this is where I would keep my USART implementation... IF I HAD ONE!!
}
1 change: 1 addition & 0 deletions Lib/Peripherals/USART/usart.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
void usart_example(void);