Closed AndreRenaud closed 2 years ago
Looking quickly didn't find information about MPSSEDivValue. What is this function for? Where the calculated value is used?
It's used to construct the value to pass as the clock divisor after MPSSETCKDivisor
. However I've just done a minimal transfer of the C Macro, and to be honest it's pretty useless (both the macro and the function I've created). The return value is only usable as two bytes, so you always need to cast it. And it only copes with the 60MHz clock, so if you've set MPSSEEnableDiv5
then it is of no help at all. It's a trade off between maintaining a very thin wrapper on top of libftdi
and providing something a little more functional - I went with the thinnest of wrappers.
I could add some explanatory comments to it though?
Yes, a comment will be useful. Even some hardware SPI example in examples
directory would be nice.
I'm personally interested in this topic because I plan to use the fast FT2232H SPI in near future instead of slow bitbanged one with FT232R. It would be a pleasant surprise to see how it works with this package.
I'm out-of-office for a bit, so have no access to hardware to confirm. However I've put together what I think is a working reference example. I'll double-check it on actual hardware later in the week and update this PR then.
Ok. Thanks!
Ok - this example now works (confirmed the signals on a scope). It doesn't show how to do reads, just writes, but hopefully gives a head start on people trying to use MPSSE/SPI on the FT4232H & FT2232H families.
I've used this library to successfully talk to various SPI chips on a custom PCB - thanks for writing this.
Thanks! Especially for the example code.
These are from https://www.intra2net.com/en/developer/libftdi/documentation/ftdi_8h_source.html#l00100