C

Qt Quick Ultralite相机示例

if(${QUL_PLATFORM_TARGET_DIR} MATCHES "mimxrt1050")
    SET(BOARD_NAME "evkbimxrt1050")
    SET(DEVICE_NAME "MIMXRT1052")
elseif(${QUL_PLATFORM_TARGET_DIR} MATCHES "mimxrt1060")
    SET(BOARD_NAME "evkbmimxrt1060")
    SET(DEVICE_NAME "MIMXRT1062")
elseif(${QUL_PLATFORM_TARGET_DIR} MATCHES "mimxrt1064")
    SET(BOARD_NAME "evkmimxrt1064")
    SET(DEVICE_NAME "MIMXRT1064")
endif()

message(STATUS "NXP board: ${BOARD_NAME}")
message(STATUS "NXP SDK directory: ${QUL_BOARD_SDK_DIR}")

if(NOT EXISTS "${QUL_BOARD_SDK_DIR}/boards/${BOARD_NAME}/driver_examples/csi/rgb565")
    message(FATAL_ERROR "NXP's CSI driver example not found at ${QUL_BOARD_SDK_DIR}")
endif()

target_link_libraries(camera PRIVATE Qul::PlatformBSPConfig)

if(IAR)
    target_compile_options(camera PRIVATE
        $<$<COMPILE_LANGUAGE:C>:--diag_suppress=Pa082>
    )
    #Pa082 order of volatile accesses is undefined
else()
    target_compile_options(camera PRIVATE
        -Wno-error=unused-parameter
    )
endif()

target_compile_definitions(camera PRIVATE
    SDK_I2C_BASED_COMPONENT_USED=1
    SERIAL_PORT_TYPE_UART=1
)

target_include_directories(camera PRIVATE
    "${QUL_BOARD_SDK_DIR}/boards/${BOARD_NAME}/driver_examples/csi/rgb565"
    "${QUL_BOARD_SDK_DIR}/CMSIS/Include/"
    "${QUL_BOARD_SDK_DIR}/components/"
    "${QUL_BOARD_SDK_DIR}/components/uart"
    "${QUL_BOARD_SDK_DIR}/components/serial_manager"
    "${QUL_BOARD_SDK_DIR}/components/video/"
    "${QUL_BOARD_SDK_DIR}/components/video/camera/"
    "${QUL_BOARD_SDK_DIR}/components/video/camera/device/"
    "${QUL_BOARD_SDK_DIR}/components/video/camera/receiver/"
    "${QUL_BOARD_SDK_DIR}/components/video/camera/receiver/csi"
    "${QUL_BOARD_SDK_DIR}/components/video/camera/device/ov7725/"
    "${QUL_BOARD_SDK_DIR}/components/video/camera/device/mt9m114/"
    "${QUL_BOARD_SDK_DIR}/components/video/camera/device/sccb/"
    "${QUL_BOARD_SDK_DIR}/components/video/i2c/"
    "${QUL_BOARD_SDK_DIR}/devices/${DEVICE_NAME}/"
    "${QUL_BOARD_SDK_DIR}/devices/${DEVICE_NAME}/drivers/"
    "${QUL_BOARD_SDK_DIR}/devices/${DEVICE_NAME}/utilities/debug_console"
    "${CMAKE_CURRENT_SOURCE_DIR}/../.."
)

target_sources(camera PRIVATE
    "${QUL_BOARD_SDK_DIR}/boards/${BOARD_NAME}/driver_examples/csi/rgb565/camera_support.c"
    "${QUL_BOARD_SDK_DIR}/components/video/camera/device/mt9m114/fsl_mt9m114.c"
    "${QUL_BOARD_SDK_DIR}/components/video/camera/receiver/csi/fsl_csi_camera_adapter.c"
    "${QUL_BOARD_SDK_DIR}/components/video/i2c/fsl_video_i2c.c"
    "${QUL_BOARD_SDK_DIR}/devices/${DEVICE_NAME}/drivers/fsl_csi.c"
    pin_mux_csi.c
    camerainterface.cpp
)