bloguetronica / cp2130-qt

A C++ class that uses libusb to interface with CP2130 devices. It can be used to configure the OTP ROM of such devices, as well as to control them. The class was made for Qt. If you wish to use a derived non-Qt version, please refer to https://github.com/bloguetronica/cp2130.
0 stars 0 forks source link

Function getSPIDelays() always returns the delays for channel 0 #37

Closed samuelfmlourenco closed 2 years ago

samuelfmlourenco commented 2 years ago

The function above should return the SPI delays for the given channel. However, regardless of the value being passed to the channel argument, it always returns the delays for channel 0. This is because the above value is not passed to wIndex when controlTransfer() is called. In line 590, this is evident:

controlTransfer(GET, GET_SPI_DELAY, 0x0000, 0x0000, controlBufferIn, GET_SPI_DELAY_WLEN, errcnt, errstr);

To fix this issue, the line above should be changed to:

controlTransfer(GET, GET_SPI_DELAY, 0x0000, channel, controlBufferIn, GET_SPI_DELAY_WLEN, errcnt, errstr);

samuelfmlourenco commented 2 years ago

Fixed in version 2.2.5.