I’m using two peripherals (ADC & UART) that have callback functions generated by PSoC Creator. Application notes tell me that these callback functions have to be explicitly registered in my program before entering different power modes. However, I can’t find registration calls in any example code in the Github repository. Am I missing something?
As I understand it (correct me if I’m wrong), certain components need to do something when transitioning to/from certain power modes. For these components, PSoC Creator generates a file with the name ComponentName_PM.c. The UART component does not have such a file, but the ADC does. The code in file ADC_PM.c can be seen below.
It has a callback structure associated with DeepSleep. Appnotes lead me to believe it has to be registered with the Cy_SysPm_RegisterCallback() function. However, the example project OnethinxCreator_ADC doesn’t do this, so I’m confused. Does the stack code somehow take care of this?
I am not exactly sure how it is handled in the stack. Maybe Rolf can explain more. But I have not registered a callback, and everything works okay. I worked on several projects for customers that needed UART, I2C, ADC, and I did not need to register a callback on the Onethinx module.
I am working on a PSoC4 project right now, and I do need to register a callback. Did the application note you read specify the PSoC version it was for?
The appnote is AN219528. It applies to all PSoC parts.
Just to complicate things more, I tried registering the ADC DeepSleep callback. After I did this, the module would not join. After I removed the registration call, the module joined correctly.