Skip to content

Commit

Permalink
Squashed 'Software/pico-uart-bridge/' content from commit 9d0df32
Browse files Browse the repository at this point in the history
git-subtree-dir: Software/pico-uart-bridge
git-subtree-split: 9d0df3277dcbbbcc9dd5e847205407560f512194
  • Loading branch information
devinatkin committed Dec 12, 2024
0 parents commit eab4425
Show file tree
Hide file tree
Showing 11 changed files with 598 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

on:
- push
- pull_request

jobs:
CI:
runs-on: ubuntu-22.04
steps:
- name: 'Check out code'
uses: actions/checkout@v4

- name: 'Install dependencies'
run: |
sudo apt-get install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi
- name: 'Update Submodules'
run: |
git submodule sync --recursive
git submodule update --init --recursive
- name: 'Configure'
run: |
mkdir -p build
cmake -B build
- name: 'Build'
run: |
make -C build
- name: 'Upload binary'
uses: actions/upload-artifact@v4
with:
name: pico-uart-bridge.uf2
path: build/uart_bridge.uf2
retention-days: 5
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vscode
build
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "pico-sdk"]
path = pico-sdk
url = https://github.com/raspberrypi/pico-sdk.git
23 changes: 23 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-License-Identifier: MIT

cmake_minimum_required(VERSION 3.13)

include(pico-sdk/pico_sdk_init.cmake)

project(pico_uart_bridge)

pico_sdk_init()

add_executable(uart_bridge uart-bridge.c usb-descriptors.c)

target_include_directories(uart_bridge PUBLIC
./
pico-sdk/lib/tinyusb/src)

target_link_libraries(uart_bridge
hardware_flash
pico_multicore
pico_stdlib
tinyusb_device)

pico_add_extra_outputs(uart_bridge)
25 changes: 25 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
The MIT License (MIT)
=====================

Copyright © 2021 Álvaro Fernández Rojas <[email protected]>

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Raspberry Pi Pico USB-UART Bridge
=================================

This program bridges the Raspberry Pi Pico HW UARTs to two independent USB CDC serial devices in order to behave like any other USB-to-UART Bridge controllers.

Disclaimer
----------

This software is provided without warranty, according to the MIT License, and should therefore not be used where it may endanger life, financial stakes, or cause discomfort and inconvenience to others.

Raspberry Pi Pico Pinout
------------------------

| Raspberry Pi Pico GPIO | Function |
|:----------------------:|:--------:|
| GPIO16 (Pin 21) | UART0 TX |
| GPIO17 (Pin 22) | UART0 RX |
| GPIO4 (Pin 6) | UART1 TX |
| GPIO5 (Pin 7) | UART1 RX |
17 changes: 17 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

BASE_DIR="$(dirname ${BASH_SOURCE[0]})"
BUILD_DIR=$BASE_DIR/build
PICO_SDK_DIR=$BASE_DIR/pico-sdk

main() {
if [ ! -d "$PICO_SDK_DIR/.git" ]; then
git submodule sync --recursive
git submodule update --init --recursive
fi

cmake -B $BUILD_DIR -S $BASE_DIR
make -C $BUILD_DIR
}

main $@
1 change: 1 addition & 0 deletions pico-sdk
Submodule pico-sdk added at 6a7db3
21 changes: 21 additions & 0 deletions tusb_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: MIT
/*
* Copyright (c) 2021 Álvaro Fernández Rojas <[email protected]>
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
* Copyright (c) 2020 Damien P. George
*/

#if !defined(_TUSB_CONFIG_H_)
#define _TUSB_CONFIG_H_

#include <tusb_option.h>

#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE

#define CFG_TUD_CDC 2
#define CFG_TUD_CDC_RX_BUFSIZE 1024
#define CFG_TUD_CDC_TX_BUFSIZE 1024

void usbd_serial_init(void);

#endif /* _TUSB_CONFIG_H_ */
Loading

0 comments on commit eab4425

Please sign in to comment.