Compilation warning for I2C Deepsleep Callback functions

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
GaryLim
Employee
Employee
10 questions asked First like received 10 replies posted

MTB 3.0 with PDL release-v1.6.1:
Building the project will result in a warning message where callback pointer is not compatible.

Is it possible for the PDL to be updated so that there is no need to manually update these files? 

 

main.c:674:50: warning: initialization of
'cy_en_syspm_status_t (*)(cy_stc_syspm_callback_params_t *, cy_en_syspm_callback_mode_t)' from incompatible pointer type
'cy_en_syspm_status_t (*)(const cy_stc_syspm_callback_params_t *, cy_en_syspm_callback_mode_t)' [-Wincompatible-pointer-types]

 



This warning is due to the compatibility of the callback define type of cy_en_syspm_status_t and cy_scb_i2c.c and cy_scb_i2c.h.

main.c

 

/* Callback declaration for I2C Deep Sleep mode */
cy_stc_syspm_callback_t i2c_deep_sleep_cb = {Cy_SCB_I2C_DeepSleepCallback, /* Callback function */
CY_SYSPM_DEEPSLEEP, /* Callback type */
0, /* Skip mode */
&i2cCallbackParams, /* Callback params */
NULL, NULL}; /* For internal usage */

 

/mtb_shared/mtb-pdl-cat2/release-v1.6.1/drivers/include/cy_syspm.h

 

typedef cy_en_syspm_status_t (*Cy_SysPmCallback) (cy_stc_syspm_callback_params_t *callbackParams, cy_en_syspm_callback_mode_t mode);

 

Original: /mtb_shared/mtb-pdl-cat2/release-v1.6.1/drivers/include/cy_scb_i2c.h

 

cy_en_syspm_status_t Cy_SCB_I2C_DeepSleepCallback(cy_stc_syspm_callback_params_t const *callbackParams, cy_en_syspm_callback_mode_t mode);

 

Original: /mtb_shared/mtb-pdl-cat2/release-v1.6.1/drivers/source/cy_scb_i2c.c

 

cy_en_syspm_status_t Cy_SCB_I2C_DeepSleepCallback(cy_stc_syspm_callback_params_t const *callbackParams, cy_en_syspm_callback_mode_t mode)

 


Remove the "const" from the following declaration to remove the compilation warning message.

Modified: /mtb_shared/mtb-pdl-cat2/release-v1.6.1/drivers/include/cy_scb_i2c.h

 

cy_en_syspm_status_t Cy_SCB_I2C_DeepSleepCallback(cy_stc_syspm_callback_params_t *callbackParams, cy_en_syspm_callback_mode_t mode);

 

Modified: /mtb_shared/mtb-pdl-cat2/release-v1.6.1/drivers/source/cy_scb_i2c.c

 

cy_en_syspm_status_t Cy_SCB_I2C_DeepSleepCallback(cy_stc_syspm_callback_params_t *callbackParams, cy_en_syspm_callback_mode_t mode)

 

 

0 Likes
1 Solution
PandaS
Moderator
Moderator
Moderator
250 replies posted 100 solutions authored 5 likes given

Hi @GaryLim ,

Thank you for pointing this out in the I2C driver. I will create an internal ticket regarding the issue of compiler warning caused due to const qualifier in deepsleep callback API in the new version of PDL.

Warm regards

Sobhit

View solution in original post

0 Likes
1 Reply
PandaS
Moderator
Moderator
Moderator
250 replies posted 100 solutions authored 5 likes given

Hi @GaryLim ,

Thank you for pointing this out in the I2C driver. I will create an internal ticket regarding the issue of compiler warning caused due to const qualifier in deepsleep callback API in the new version of PDL.

Warm regards

Sobhit

0 Likes