Re: ILI9341 & XPT2046 Touchscreen
Posted: Wed Apr 12, 2023 6:58 pm
Hi Ben,
Thanks - I'll continue with my 'combined' component for now....
Note that using MX_SPI_CHANNEL_IN_USE = 1 as above does seem to solve the transmit problem - though would need to alter the redirect for initialise - the 'second' component using the channel could just redirect to an empty routine - though this might cause issues if it is initialised first and used before the 'first' component?
Thinking aloud:
I wondered - though it would entail a fair amount of change - why the CAL_SPI routines don't just 'pass' a channel number. This would remove the duplication of code at the expense of an extra parameter and some extra storage in the backend code.
So in (very) pseudocode:
CAL_SPI_1::SPI_Master_Byte(123) in the component code would call SPI_SendByte(1, 123)
The SPI backend code would have (possibly) an array of SPI channel details (setup per channel on initialise) - and then, for example,
SPI_SendByte(channel, data) {
SPIDetails *dat = SPIDat[channel];
Use values from dat...
Though it might be just as easy to code it all in FC - and have the component do all the work?
Martin
Another aside - some topics (this, for example) - I don't get notifications for. Others I do (even if I've not posted) - and will a notification for any new post. Is there a setting for this?
Thanks - I'll continue with my 'combined' component for now....
Note that using MX_SPI_CHANNEL_IN_USE = 1 as above does seem to solve the transmit problem - though would need to alter the redirect for initialise - the 'second' component using the channel could just redirect to an empty routine - though this might cause issues if it is initialised first and used before the 'first' component?
Thinking aloud:
I wondered - though it would entail a fair amount of change - why the CAL_SPI routines don't just 'pass' a channel number. This would remove the duplication of code at the expense of an extra parameter and some extra storage in the backend code.
So in (very) pseudocode:
CAL_SPI_1::SPI_Master_Byte(123) in the component code would call SPI_SendByte(1, 123)
The SPI backend code would have (possibly) an array of SPI channel details (setup per channel on initialise) - and then, for example,
SPI_SendByte(channel, data) {
SPIDetails *dat = SPIDat[channel];
Use values from dat...
Though it might be just as easy to code it all in FC - and have the component do all the work?
Martin
Another aside - some topics (this, for example) - I don't get notifications for. Others I do (even if I've not posted) - and will a notification for any new post. Is there a setting for this?