-
-
Notifications
You must be signed in to change notification settings - Fork 40.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding ability to use more than one Cirque Pinnacle via SPI #24791
base: develop
Are you sure you want to change the base?
Conversation
There is now a callback to get the current SPI CS pin when operations are being used. Implement cirque_pinnacle_spi_get_cs_pin to set the pin to be used. If this function is not implemented, the weak method will use the legacy method of CIRQUE_PINNACLE_SPI_CS_PIN.
Long term, I think that #20374 is the end goal here. That said, this code is .... messy at best, and is likely to cause issues (eg, selecting the wrong device, if you're not careful). |
Yikes! "messy at best"? It's three lines and is also how SPI is designed to work. The default implementation is for backwards compatibility. This supports non pointing device usages of the devices... which is how I use them. I'm fine if you want to close this PR. These changes were the smallest changes I could make and still get my work done. |
To be clear, the implementation itself isn't what I meant by messy, but rather the functionality. From what I'm guessing, you'd be scanning the second cirque by replacing the cs pin function and switch between the main and secondary pads, correct? If so, I'm really, really not a fan of this. The way that the pmw33xx multiple sensor support may be a better way to handle this, IMO. But I'm not sure on which is the best method forward, though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would agree the consuming usage would appear be quite fragile, but will defer to others with more domain knowledge in this area.
However, the following suggestion should at least make it pass the failing CI checks.
|
||
__attribute__((weak)) uint8_t cirque_pinnacle_spi_get_cs_pin(void) { return CIRQUE_PINNACLE_SPI_CS_PIN; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__attribute__((weak)) uint8_t cirque_pinnacle_spi_get_cs_pin(void) { return CIRQUE_PINNACLE_SPI_CS_PIN; } | |
__attribute__((weak)) pin_t cirque_pinnacle_spi_get_cs_pin(void) { | |
return CIRQUE_PINNACLE_SPI_CS_PIN; | |
} |
There is now a callback to get the current SPI CS pin when operations are being used. Implement cirque_pinnacle_spi_get_cs_pin to set the pin to be used. If this function is not implemented, the weak method will use the legacy method of CIRQUE_PINNACLE_SPI_CS_PIN.
Description
Types of Changes
Issues Fixed or Closed by This PR
Checklist