CMakeLists.txt 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # OpenPuck — Zephyr RTOS port.
  2. #
  3. # Migrated from the Arduino/Adafruit-nRF52/TinyUSB sketch in ../OpenPuck.
  4. # Build (from a west workspace with this repo reachable):
  5. # west build -b adafruit_feather_nrf52840 OpenPuckZephyr
  6. #
  7. # The bare-metal RADIO peripheral is driven directly (no BLE/802.15.4), so the
  8. # Bluetooth/IEEE802154/MPSL stacks are disabled in prj.conf and the RADIO IRQ is
  9. # owned by this app.
  10. cmake_minimum_required(VERSION 3.20.0)
  11. find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
  12. project(openpuck C CXX)
  13. # Build provenance: generate git_version.h (build_info.h picks it up via
  14. # __has_include; absent -> "unknown"). Mirrors gen_version.sh in the Arduino tree.
  15. execute_process(
  16. COMMAND git -C ${CMAKE_CURRENT_SOURCE_DIR} rev-parse --short=8 HEAD
  17. OUTPUT_VARIABLE OPK_GIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE
  18. ERROR_QUIET)
  19. if(NOT OPK_GIT_HASH)
  20. set(OPK_GIT_HASH "unknown")
  21. endif()
  22. file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gen/git_version.h
  23. "// AUTO-GENERATED by CMake -- do not edit.\n#pragma once\n#define OPK_GIT_HASH \"${OPK_GIT_HASH}\"\n#define OPK_GIT_DIRTY 0\n")
  24. target_include_directories(app PRIVATE
  25. ${CMAKE_CURRENT_SOURCE_DIR}/src
  26. ${CMAKE_CURRENT_SOURCE_DIR}/src/compat
  27. ${CMAKE_CURRENT_BINARY_DIR}/gen)
  28. # status_led uses Arduino logical pin numbers; under the absolute-nRF-pin
  29. # digitalWrite shim, the SuperMini's P0.15 blue LED is absolute pin 15 (the
  30. # header's default 24 is the Adafruit logical pin). LED_BUILTIN (P1.15 = 47) is
  31. # set in the Arduino.h shim.
  32. target_compile_definitions(app PRIVATE WAKE_LED_PIN_B=15)
  33. target_sources(app PRIVATE
  34. src/main.cpp
  35. # compatibility layer
  36. src/compat/arduino_compat.cpp
  37. src/compat/littlefs_shim.cpp
  38. src/compat/serial_cdc_glue.cpp
  39. src/compat/usb_glue.cpp # Zephyr USBD backing for the TinyUSB shim
  40. src/compat/usb_device_setup.cpp # usbd_context (HID pool + CDC) bring-up
  41. src/compat/usb_webusb_class.cpp # WebUSB vendor class (config panel pipe)
  42. src/compat/usb_xinput_class.cpp # XInput (Xbox) vendor class
  43. # ported firmware modules
  44. src/config.cpp
  45. src/bonds.cpp
  46. src/identity.cpp
  47. src/triton.cpp
  48. src/gamepad_util.cpp
  49. src/radio.cpp
  50. src/rf_link.cpp
  51. src/rf_diag.cpp
  52. src/haptics.cpp
  53. src/status_led.cpp
  54. src/controllers.cpp
  55. src/puck_hid.cpp
  56. src/mode_lizard.cpp
  57. src/mode_switch_hori.cpp
  58. src/mode_switch_pro.cpp
  59. src/mode_ps5.cpp
  60. src/mode_hidgyro.cpp
  61. src/mode_xinput.cpp
  62. src/webusb_config.cpp
  63. src/serial_console.cpp
  64. src/usb_mount.cpp
  65. src/wake_hid.cpp
  66. )