We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
We use the CMSIS-Driver for SPI/I2C communication inside our project. Our application will run on 2 different hardwares. We would like to use the same binary for both devices. We can detect the current hardware, but it is not possible to change the pin / ports of the CMSIS-Driver dynamically. Because the different hardwares havn't exactly the same pin layout.
The pin/ports are set with #defines and therefore of corse it isn't possible to change anything dynamically.
For our proposal it would be great if we could adjust the pin/ports after startup but before we call the initialize function (Driver_SPI1->Initialize(...)). This could be achieved if e.g. the resource object isn't defined static const.
// SPI1 Resources SPI_RESOURCES SPI1_Resources = { ... }
Then we have access to the pin layout with:
extern SPI_RESOURCES SPI1_Resources; ... SPI1_Resources.io = /* new pin config */
Or if the CMIS-Driver has some function to access the resources object or to adjust the settings:
// with resource object access *SPI_RESOURCES SPI1_GetResources(void){return &SPI1_Resources; } // or with settings access int SPI1_ChangePinLayout(...){return SPI1_ChangePinLayout(...,&SPI1_Resources); }