This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DLP3010EVM-LC: ,请教某些API的用途

Part Number: DLP3010EVM-LC
Other Parts Discussed in Thread: DLPC3478

1:在开发3478的芯片时,在api :DLPC34XX_ControllerDeviceId_e ,我的代码不用这个句柄也能操控3010光机啊,,请问 获取的这个句柄有什么用?

2:CYPRESS_I2C_RelinquishI2CBusAccess  是和dlpc端口连接的api吗? 因为这些api没多大注释,有些功能不是理解得很透,我调用之后,发现还是不能断开连接?

      代码 断开连接该怎么做?

3:程序连接运行中,如果被意外终止程序,再次启动程序会出现连接不上光机,类似通信或usb已经被占用,这种情况怎么解决?

  • 1.这是获取DLPC ID,是DLPC3478, DLPC3478等等是哪个产品ID;这不是WINDOWS DEVICE handler. 那是USB 驱动层

    如果不读取,后续产品ID和功能可能不匹配。

    2. PC端软件通过cypress USB转I2C来控制DLPC3478.  CYPRESS_I2C_RelinquishI2CBusAccess  是通过Cypress USB装I2C放弃I2C控制在发送完毕后; CYPRESS_I2C_RequestI2CBusAccess是获取控制I2C,准备发控制指令。

    3. 如果是USB port占用,先读取状态(WINDOWS API层级),可以调用CYWINEXPORT CY_RETURN_STATUS CyResetDevice (
    CY_HANDLE handle /*Valid device handle*/
    );

    /*
    Summary
    This API closes the specified device handle and releases all resources associated with it.

    Description
    This API closes the device handle and releases all the resources allocated internally in the
    library. This API should be invoked using a valid device handle and upon successful return
    of CyOpen.

    Return Value
    * CY_SUCCESS on success.
    * CY_ERROR_INVALID_HANDLE if handle is invalid in case of Linux/Mac.
    * CY_ERROR_INVALID_PARAMETER if handle is invalid in case of Windows.
    * CY_ERROR_REQUEST_FAILED on error in case of library being not initialized (Only for Linux and Mac).

    See Also
    * CyOpen
    */
    CYWINEXPORT CY_RETURN_STATUS CyClose (
    CY_HANDLE handle /*Handle of the device that needs to be closed*/
    );

    如果是I2C占用,可以先释放CYPRESS_I2C_RelinquishI2CBusAccess,再申请CYPRESS_I2C_RequestI2CBusAccess

  • 1:我调用 CYPRESS_I2C_RelinquishI2CBusAccess 返回1,  但是不能正常释放I2C,这是为什么?

           我觉得这个api调用失败是指,调用后理论上讲是不能再通信了,但是我之后又发了信息过去,让光机投射光束,一切都正常,和没有调用          CYPRESS_I2C_RelinquishI2CBusAccess是一样的

           因为想做重新链接的需求,想断开链接我是直接调用了CYPRESS_I2C_RelinquishI2CBusAccess,但是没效果,因为还能正常通信,

           要想实现重新链接的需要,USB 和I2C 都要怎么样操作?  (我有来又调用了CyLibraryExit和CyResetDevice后,再重新链接,还是不行,出现get i2c handle failed

            真的真的请指教一下在不关闭程序时,怎样才能重新链接,像程序刚开始那样

    2:还有那个驱动具备,除了获取后,好像没什么api需要用到它的地方啊? 

    3:另一个如果是USB 被占用你说调的是window API层, 我目前是在linux下开发啊,该怎么样呢?

    非常感谢

  • 1.需要使用Cypress的API,在这个程序中没有调用。CyUSBSerial.h(cyusbserial.dll)

    /*
    Summary
    This API closes the specified device handle and releases all resources associated with it.

    Description
    This API closes the device handle and releases all the resources allocated internally in the
    library. This API should be invoked using a valid device handle and upon successful return
    of CyOpen.

    Return Value
    * CY_SUCCESS on success.
    * CY_ERROR_INVALID_HANDLE if handle is invalid in case of Linux/Mac.
    * CY_ERROR_INVALID_PARAMETER if handle is invalid in case of Windows.
    * CY_ERROR_REQUEST_FAILED on error in case of library being not initialized (Only for Linux and Mac).

    See Also
    * CyOpen
    */
    CYWINEXPORT CY_RETURN_STATUS CyClose (
    CY_HANDLE handle /*Handle of the device that needs to be closed*/
    );

    2. 这个封装在了Cypress USB/I2C的 DLL,lib中没有开放出来的。

    3. 参考Cypress Linux: docs.cypress.io/.../opening-the-app