Skip to content
28 changes: 28 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,30 @@ add_compile_options(-Wall -Werror)
# uncomment for debug slurry
add_compile_definitions(DEBUG_MESSAGES=1)

# enable per-report mouse debug only when explicitly requested
option(DEBUG_MOUSE "Enable per-report mouse debug output" OFF)
if (DEBUG_MOUSE)
add_compile_definitions(DEBUG_MOUSE=1)
endif ()

# enable per-key keyboard debug only when explicitly requested
option(DEBUG_KEYBOARD "Enable per-key keyboard debug output" OFF)
if (DEBUG_KEYBOARD)
add_compile_definitions(DEBUG_KEYBOARD=1)
endif ()

# enable HID mount/status debug only when explicitly requested
option(DEBUG_HID_STATUS "Enable HID status debug output" OFF)
if (DEBUG_HID_STATUS)
add_compile_definitions(DEBUG_HID_STATUS=1)
endif ()

# enable bluetooth hid host support when building for pico w
option(ENABLE_BLUETOOTH_HID "Enable Bluetooth HID host support on Pico W" OFF)
if (ENABLE_BLUETOOTH_HID)
add_compile_definitions(ENABLE_BLUETOOTH_HID=1)
endif ()

# set the board revision (changes which pins are mapped to which ports)
add_compile_definitions(${BOARD_TYPE})

Expand All @@ -37,4 +61,8 @@ add_compile_definitions(${BOARD_TYPE})

pico_sdk_init()

if (ENABLE_BLUETOOTH_HID AND NOT PICO_CYW43_SUPPORTED)
message(FATAL_ERROR "ENABLE_BLUETOOTH_HID requires a CYW43 board such as pico_w")
endif ()

add_subdirectory(src)
24 changes: 24 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
add_executable(amigahid-pico
input_bridge.c
main.c
usb_hid.c
)

if (ENABLE_BLUETOOTH_HID)
target_sources(amigahid-pico PRIVATE
bt_hid.c
)
endif ()

add_subdirectory(platform)
add_subdirectory(util)
add_subdirectory(display)
Expand All @@ -16,6 +23,7 @@ pico_enable_stdio_uart(amigahid-pico 1)

target_link_libraries(amigahid-pico PUBLIC
pico_stdlib
pico_util
pico_multicore
hardware_dma
hardware_gpio
Expand All @@ -25,6 +33,22 @@ target_link_libraries(amigahid-pico PUBLIC
tinyusb_board
)

if (ENABLE_BLUETOOTH_HID)
target_compile_options(amigahid-pico PRIVATE
-Wno-error=maybe-uninitialized
)
target_link_libraries(amigahid-pico PUBLIC
pico_cyw43_arch_none
pico_btstack_ble
pico_btstack_classic
pico_btstack_cyw43
)
endif ()

if (ENABLE_BLUETOOTH_HID AND COMMAND suppress_btstack_warnings)
suppress_btstack_warnings()
endif ()

add_compile_definitions(PICO_USE_MALLOC_MUTEX=0)

pico_add_extra_outputs(amigahid-pico)
Loading