If I modify one of the generated c files for a component, is there a way to lock the file so that it won't be overwritten the next time I rebuild?
That file will be over written the next clean & build. Please share the parameters or code you are trying to modify. Perhaps you can create your own header file (with the #include) and accomplish the desired result?
You are probably correct in that all I have to do is copy the modified function to a different location. I thought maybe there is a way to make changes permanent. All I did was slightly modify the init function in the LCD component to support a display I was using.
You may use the configuration dialog of the component and under the "Built-in"-tab switch on the "Cy_Suppress_API_Gen" property.
If I suppress that, the component's API file is removed when I do a new clean and build. I'm only trying to preserve changes to the API. How does Creator allow modification to some of the component APIs as when they show "add your code here"?
There are dedicated ponts within the code, clearly marked.
Take this as an example
/* Place your Interrupt code here. */
/* `#START ADC_SAR_Seq_1_IRQ_Interrupt` */
/* `#END` */
I have not found yet a hint in Cypress's documentation whether the /* '# lead-in can be used to permanently change APIs.
Additionally: the generated API-files are not deleted, only removed from project. You may add them manually back again and they will be treated like your own files.
I only needed a new init function so I put it in with my files. I also had to copy one low level function that wasn't exposed by the API. I've always wondered how they are able to protect those areas of the API that allow user code to be added.