Revert Project
This commit is contained in:
6
.gitmodules
vendored
6
.gitmodules
vendored
@@ -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
|
|
||||||
|
|||||||
@@ -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)
|
|
||||||
13
README.md
13
README.md
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
### System Package Requirements
|
### 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
|
### Build Instructions
|
||||||
|
|
||||||
@@ -18,4 +18,13 @@ mkdir build
|
|||||||
cd build
|
cd build
|
||||||
cmake ..
|
cmake ..
|
||||||
make
|
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-PIO-USB deleted from 3c1eec341a
Submodule libs/pico-sdk deleted from 9a4113fbba
@@ -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)
|
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
|
target_sources(${target_name} PRIVATE
|
||||||
hirsute.c
|
hirsute.c
|
||||||
${PICO_TINYUSB_PATH}/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c
|
${PICO_SDK_PATH}/lib/tinyusb/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/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_link_options(${target_name} PRIVATE -Xlinker --print-memory-usage)
|
||||||
target_compile_options(${target_name} PRIVATE -Wall -Wextra)
|
target_compile_options(${target_name} PRIVATE -Wall -Wextra)
|
||||||
|
|
||||||
target_compile_definitions(${target_name} PRIVATE PIO_USB_USE_TINYUSB)
|
target_compile_definitions(${target_name} PRIVATE PIO_USB_USE_TINYUSB)
|
||||||
target_include_directories(${target_name} PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
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})
|
pico_add_extra_outputs(${target_name})
|
||||||
|
|||||||
6
src/config.h
Normal file
6
src/config.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
#define BAUD_RATE 115200
|
||||||
|
|
||||||
|
#endif // CONFIG_H
|
||||||
@@ -16,17 +16,22 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "hardware/clocks.h"
|
|
||||||
#include "pico/stdlib.h"
|
#include "pico/stdlib.h"
|
||||||
#include "pico/multicore.h"
|
#include "pico/multicore.h"
|
||||||
#include "pico/bootrom.h"
|
#include "pico/bootrom.h"
|
||||||
|
|
||||||
#include "pio_usb.h"
|
#include "pio_usb.h"
|
||||||
#include "tusb.h"
|
#include "tusb.h"
|
||||||
|
#include "bsp/board.h"
|
||||||
|
#include "hardware/uart.h"
|
||||||
|
#include "hardware/clocks.h"
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
void core_one() {
|
void core_one() {
|
||||||
sleep_ms(10);
|
sleep_ms(10);
|
||||||
pio_usb_configuration_t pio_config = PIO_USB_DEFAULT_CONFIG;
|
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_configure(1, TUH_CFGID_RPI_PIO_USB_CONFIGURATION, &pio_config);
|
||||||
tuh_init(1);
|
tuh_init(1);
|
||||||
while (true) {
|
while (true) {
|
||||||
@@ -35,14 +40,20 @@ void core_one() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
board_init();
|
||||||
set_sys_clock_khz(120000, true);
|
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);
|
sleep_ms(10);
|
||||||
multicore_reset_core1();
|
multicore_reset_core1();
|
||||||
|
multicore_launch_core1(core_one);
|
||||||
|
board_led_write(true);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
tud_task();
|
stdio_flush();
|
||||||
tud_cdc_write_flush();
|
sleep_us(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,28 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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
|
// COMMON CONFIGURATION
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
@@ -37,7 +59,7 @@
|
|||||||
#define CFG_TUSB_OS OPT_OS_PICO
|
#define CFG_TUSB_OS OPT_OS_PICO
|
||||||
|
|
||||||
// Enable device stack
|
// 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
|
// Enable host stack with pio-usb if Pico-PIO-USB library is available
|
||||||
#define CFG_TUH_ENABLED 1
|
#define CFG_TUH_ENABLED 1
|
||||||
@@ -65,19 +87,19 @@
|
|||||||
// DEVICE CONFIGURATION
|
// DEVICE CONFIGURATION
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef CFG_TUD_ENDPOINT0_SIZE
|
// #ifndef CFG_TUD_ENDPOINT0_SIZE
|
||||||
#define CFG_TUD_ENDPOINT0_SIZE 64
|
// #define CFG_TUD_ENDPOINT0_SIZE 64
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
//------------- CLASS -------------//
|
// //------------- CLASS -------------//
|
||||||
#define CFG_TUD_CDC 1
|
// #define CFG_TUD_CDC 1
|
||||||
|
|
||||||
// CDC FIFO size of TX and RX
|
// // CDC FIFO size of TX and RX
|
||||||
#define CFG_TUD_CDC_RX_BUFSIZE 256
|
// #define CFG_TUD_CDC_RX_BUFSIZE 256
|
||||||
#define CFG_TUD_CDC_TX_BUFSIZE 256
|
// #define CFG_TUD_CDC_TX_BUFSIZE 256
|
||||||
|
|
||||||
// CDC Endpoint transfer buffer size, more is faster
|
// // CDC Endpoint transfer buffer size, more is faster
|
||||||
#define CFG_TUD_CDC_EP_BUFSIZE 64
|
// #define CFG_TUD_CDC_EP_BUFSIZE 64
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// HOST CONFIGURATION
|
// HOST CONFIGURATION
|
||||||
|
|||||||
Reference in New Issue
Block a user