Revert Project

This commit is contained in:
2025-07-24 19:58:49 -04:00
parent 9954f24537
commit 7eb2bcaaae
9 changed files with 95 additions and 41 deletions

6
.gitmodules vendored
View File

@@ -1,6 +0,0 @@
[submodule "libs/Pico-PIO-USB"]
path = libs/Pico-PIO-USB
url = https://github.com/sekigon-gonnoc/Pico-PIO-USB
[submodule "libs/pico-sdk"]
path = libs/pico-sdk
url = https://github.com/raspberrypi/pico-sdk

View File

@@ -1,9 +0,0 @@
cmake_minimum_required(VERSION 3.13)
set(PICO_SDK_PATH "${CMAKE_CURRENT_LIST_DIR}/libs/pico-sdk")
include ("${CMAKE_CURRENT_LIST_DIR}/libs/pico-sdk/external/pico_sdk_import.cmake")
project(hirsute)
pico_sdk_init()
set(PICO_PIO_USB_DIR "${CMAKE_CURRENT_LIST_DIR}/libs/Pico-PIO-USB")
add_subdirectory(${PICO_PIO_USB_DIR} pico_pio_usb)
add_subdirectory(src)

View File

@@ -6,7 +6,7 @@
### System Package Requirements
`cmake python3 build-essential gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib picotool`
`cmake python3 build-essential gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib picotool pioasm`
### Build Instructions
@@ -19,3 +19,12 @@ cd build
cmake ..
make
```
## Many Thanks
These projects were crazy helpful in figuring out how to put this together.
* [Pico Read USB Keyboard PIO](https://github.com/vruivo/pico_read_usb_keyboard_pio)
* [Pico-PIO-USB](https://github.com/sekigon-gonnoc/Pico-PIO-USB)
* [PS2 2 Plus](https://github.com/n055/ps22plus)
* [Macintosh Hardware Description](https://ia601206.us.archive.org/20/items/Mac_Hardware_Info_Mac_128K/Mac_Hardware_Info_Mac_128K.pdf)

Submodule libs/pico-sdk deleted from 9a4113fbba

View File

@@ -1,17 +1,40 @@
cmake_minimum_required(VERSION 3.13)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(PICO_SDK_PATH "${CMAKE_CURRENT_LIST_DIR}/../libs/pico-sdk")
include("${PICO_SDK_PATH}/external/pico_sdk_import.cmake")
set(PICO_PIO_USB_DIR "${CMAKE_CURRENT_LIST_DIR}/../libs/pico-pio-hirsute")
add_subdirectory(${PICO_PIO_USB_DIR} pico_pio_usb)
set(target_name hirsute)
add_executable(${target_name})
project(${target_name} C CXX ASM)
add_executable(${target_name}
hirsute.c
)
target_sources(${target_name} PRIVATE
hirsute.c
${PICO_TINYUSB_PATH}/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c
${PICO_TINYUSB_PATH}/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
${PICO_SDK_PATH}/lib/tinyusb/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c
${PICO_SDK_PATH}/lib/tinyusb/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
)
pico_sdk_init()
pico_enable_stdio_usb(${target_name} 0)
pico_enable_stdio_uart(${target_name} 1)
target_link_options(${target_name} PRIVATE -Xlinker --print-memory-usage)
target_compile_options(${target_name} PRIVATE -Wall -Wextra)
target_compile_definitions(${target_name} PRIVATE PIO_USB_USE_TINYUSB)
target_include_directories(${target_name} PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(${target_name} PRIVATE pico_stdlib pico_pio_usb tinyusb_device tinyusb_host)
target_link_libraries(${target_name} PRIVATE pico_stdlib pico_multicore pico_pio_usb tinyusb_host tinyusb_board)
# Generate hex file
pico_add_extra_outputs(${target_name})

6
src/config.h Normal file
View File

@@ -0,0 +1,6 @@
#ifndef CONFIG_H
#define CONFIG_H
#define BAUD_RATE 115200
#endif // CONFIG_H

View File

@@ -16,17 +16,22 @@
#include <stdio.h>
#include <string.h>
#include "hardware/clocks.h"
#include "pico/stdlib.h"
#include "pico/multicore.h"
#include "pico/bootrom.h"
#include "pio_usb.h"
#include "tusb.h"
#include "bsp/board.h"
#include "hardware/uart.h"
#include "hardware/clocks.h"
#include "config.h"
void core_one() {
sleep_ms(10);
pio_usb_configuration_t pio_config = PIO_USB_DEFAULT_CONFIG;
pio_config.pin_dp = 16; // USB D+ pin on GP16
tuh_configure(1, TUH_CFGID_RPI_PIO_USB_CONFIGURATION, &pio_config);
tuh_init(1);
while (true) {
@@ -35,13 +40,19 @@ void core_one() {
}
int main() {
board_init();
set_sys_clock_khz(120000, true);
uart_init(UART_ID, BAUD_RATE);
gpio_set_function(UART_TX_PIN, GPIO_FUNC_UART);
gpio_set_function(UART_RX_PIN, GPIO_FUNC_UART);
sleep_ms(10);
multicore_reset_core1();
multicore_launch_core1(core_one);
board_led_write(true);
while (true) {
tud_task();
tud_cdc_write_flush();
stdio_flush();
sleep_us(10);
}
return 0;

View File

@@ -30,6 +30,28 @@
extern "C" {
#endif
//--------------------------------------------------------------------+
// Board Specific Configuration
//--------------------------------------------------------------------+
#ifndef CFG_TUSB_MCU
#define CFG_TUSB_MCU OPT_MCU_RP2040
#endif
#if CFG_TUSB_MCU == OPT_MCU_RP2040
// change to 1 if using pico-pio-usb as host controller for raspberry rp2040
#define CFG_TUH_RPI_PIO_USB 1
#define BOARD_TUH_RHPORT CFG_TUH_RPI_PIO_USB
#endif
// RHPort number used for host can be defined by board.mk, default to port 0
#ifndef BOARD_TUH_RHPORT
#define BOARD_TUH_RHPORT 0
#endif
// RHPort max operational speed can defined by board.mk
#ifndef BOARD_TUH_MAX_SPEED
#define BOARD_TUH_MAX_SPEED OPT_MODE_DEFAULT_SPEED
#endif
//--------------------------------------------------------------------
// COMMON CONFIGURATION
//--------------------------------------------------------------------
@@ -37,7 +59,7 @@
#define CFG_TUSB_OS OPT_OS_PICO
// Enable device stack
#define CFG_TUD_ENABLED 1
// #define CFG_TUD_ENABLED 1
// Enable host stack with pio-usb if Pico-PIO-USB library is available
#define CFG_TUH_ENABLED 1
@@ -65,19 +87,19 @@
// DEVICE CONFIGURATION
//--------------------------------------------------------------------
#ifndef CFG_TUD_ENDPOINT0_SIZE
#define CFG_TUD_ENDPOINT0_SIZE 64
#endif
// #ifndef CFG_TUD_ENDPOINT0_SIZE
// #define CFG_TUD_ENDPOINT0_SIZE 64
// #endif
//------------- CLASS -------------//
#define CFG_TUD_CDC 1
// //------------- CLASS -------------//
// #define CFG_TUD_CDC 1
// CDC FIFO size of TX and RX
#define CFG_TUD_CDC_RX_BUFSIZE 256
#define CFG_TUD_CDC_TX_BUFSIZE 256
// // CDC FIFO size of TX and RX
// #define CFG_TUD_CDC_RX_BUFSIZE 256
// #define CFG_TUD_CDC_TX_BUFSIZE 256
// CDC Endpoint transfer buffer size, more is faster
#define CFG_TUD_CDC_EP_BUFSIZE 64
// // CDC Endpoint transfer buffer size, more is faster
// #define CFG_TUD_CDC_EP_BUFSIZE 64
//--------------------------------------------------------------------
// HOST CONFIGURATION