deskhop/CMakeLists.txt
Hrvoje Cavrak 560f3dca74 New features, bugfixes and optimizations
Some of the features implemented in this release are:
  - TinyUSB used to handle HOST management as well
  - USB hub support (tried an ancient one and it worked)
  - Early and buggy support for mouse on the keyboard side
    but have no unified usb receivers to test
  - Rudimentary HID report descriptor parsing, support for
    mice that don't send wheel data unless in report protocol mode
  - Implemented queueing for keyboard/mouse messages with
    hid report send verification
  - Split firmware upgrade shortcut to two
    now it's left-shift + F12 + A + right shift to write board A
             left-shift + F12 + B + right shift to write board B
  - Fixed keyboard stuck in outputing chars if you hold down a key
    and change screens while doing it
  - Implemented cursor hiding, so the screen we are moving away from
    parks cursor at top right corner and it looks more natural and
    feels intuitive
  - Implemented switch lock, use Ctrl + L to lock and unlock
    desktop switching
  - Implemented jump threshold, works like barrier opacity - you can
    define if mouse immediately jumps over or you need to give it a bit
    of a "nudge"
2024-01-03 10:48:34 +01:00

89 lines
2.5 KiB
CMake

cmake_minimum_required(VERSION 3.13)
set(PICO_SDK_FETCH_FROM_GIT off)
set(PICO_BOARD=pico)
include(pico_sdk_import.cmake)
set(CMAKE_CXX_FLAGS "-Ofast -Wall -mcpu=cortex-m0plus -mtune=cortex-m0plus")
set(PICO_COPY_TO_RAM 1)
project(deskhop_project C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
pico_sdk_init()
set(PICO_PIO_USB_DIR ${CMAKE_CURRENT_LIST_DIR}/Pico-PIO-USB)
add_library(Pico-PIO-USB STATIC
${PICO_PIO_USB_DIR}/src/pio_usb.c
${PICO_PIO_USB_DIR}/src/pio_usb_host.c
${PICO_PIO_USB_DIR}/src/usb_crc.c
)
pico_generate_pio_header(Pico-PIO-USB ${PICO_PIO_USB_DIR}/src/usb_tx.pio)
pico_generate_pio_header(Pico-PIO-USB ${PICO_PIO_USB_DIR}/src/usb_rx.pio)
target_link_libraries(Pico-PIO-USB PRIVATE
pico_stdlib
pico_multicore
hardware_pio
hardware_dma
)
target_include_directories(Pico-PIO-USB PRIVATE ${PICO_PIO_USB_DIR})
set(COMMON_SOURCES
${CMAKE_CURRENT_LIST_DIR}/src/usb_descriptors.c
${CMAKE_CURRENT_LIST_DIR}/src/hid_parser.c
${CMAKE_CURRENT_LIST_DIR}/src/utils.c
${CMAKE_CURRENT_LIST_DIR}/src/handlers.c
${CMAKE_CURRENT_LIST_DIR}/src/setup.c
${CMAKE_CURRENT_LIST_DIR}/src/keyboard.c
${CMAKE_CURRENT_LIST_DIR}/src/mouse.c
${CMAKE_CURRENT_LIST_DIR}/src/led.c
${CMAKE_CURRENT_LIST_DIR}/src/uart.c
${CMAKE_CURRENT_LIST_DIR}/src/usb.c
${CMAKE_CURRENT_LIST_DIR}/src/main.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
)
set(COMMON_INCLUDES
${CMAKE_CURRENT_LIST_DIR}/src
${PICO_PIO_USB_DIR}/src
)
set(COMMON_LINK_LIBRARIES
pico_stdlib
hardware_uart
hardware_gpio
hardware_pio
tinyusb_device
tinyusb_host
pico_multicore
Pico-PIO-USB
)
# Pico A - Keyboard
add_executable(board_A)
target_sources(board_A PUBLIC ${COMMON_SOURCES})
target_compile_definitions(board_A PRIVATE BOARD_ROLE=0 PIO_USB_USE_TINYUSB=1 PIO_USB_DP_PIN_DEFAULT=14)
target_include_directories(board_A PUBLIC ${COMMON_INCLUDES})
target_link_libraries(board_A PUBLIC ${COMMON_LINK_LIBRARIES})
pico_enable_stdio_usb(board_A 0)
pico_add_extra_outputs(board_A)
# Pico B - Mouse
add_executable(board_B)
target_compile_definitions(board_B PRIVATE BOARD_ROLE=1 PIO_USB_USE_TINYUSB=1 PIO_USB_DP_PIN_DEFAULT=14)
target_sources(board_B PUBLIC ${COMMON_SOURCES})
target_include_directories(board_B PUBLIC ${COMMON_INCLUDES})
target_link_libraries(board_B PUBLIC ${COMMON_LINK_LIBRARIES})
pico_enable_stdio_usb(board_B 0)
pico_add_extra_outputs(board_B)