@Roger I think using a single buffer should work fine as TX DMA will move a byte and increase its buffer address counter at the start of the transfer, while RX DMA should write to at the end of the byte transfer, but make sure the RX buffer register is cleared at the end, otherwise and incoming byte waiting in the RX buffer register may get written to the RX buffer address right away at the start.
That is something that is done in the sdfat library DMA for the Due, even though it uses a different buffer for TX and RX, and I had to do it for the STM, but I believe I did not include it in the ILI_STM library files. It is included in the official sdfat repo, in the stm32 cpp.
Besides that, I believe it's probably more flexible to be able to set both independently, and whenever you want just pass the same pointer for both.
About the ISR, I'm curious to see how you resolved the callback.
The best way I could imagine was like this:
Have a pointer called say DMACallback.
Set that pointer to a function within the library by default.
Set the ISR to call the function in that variable, DMACallback, in every case.
If the DMATransfer call provides a Callback pointer, change the value of DMACallback to call that.
That way the ISR always will call whatever DMACallback points to, with no if within the ISR, and the library implementation of the callback could be just setting a Boolean to true or false, that the DMATransfer function can check when it need to block until the transfer is complete.
I hope I explained it clear, I think I have it clearer in my mind than I can explain.
I couldn't think on any other easy solution.
Regarding the global variable, I had the same issues, I couldn't figure a way to get it to compile and to be used in the ISR successfully unless I made it global. And I had to set the ISR a static outside of the class, otherwise I would get some errors.
Did you put the code in the repo or somewhere else? I can modify the sdfat library to use it and test with an sdcard as that will involve reads and writes, and I can even get some performance tests done.