cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ 6

DaGa_4352226
New Contributor II

Hello community,

I am working with the CYBLE-416045-02 chip (with CY8CPROTO-063-BLE KIT) but i am declaring a function in my .h file as the following:

uint8_t WriteCommandPacket(uint16_t cmd);

and the user can send differents commands:

#define CMD_WATER (0x3608)
#define CMD_ALCOHOL (0x3615)
#define CMD_STOP_MEASUREMENT (0x3FF9)
#define CMD_SOFT_RESET (0x0006)
#define CMD_READ_I (0x367C)
#define CMD_READ_II (0xE102)

 

it is why i am using the uint16_t type to send this command. But the PSoC Creattor 4.4 is telling me the following error:

masterI2C.h:68:9: error: conflicting types for 'WriteCommandPacket'
uint8_t WriteCommandPacket(uint16_t cmd);

 

The strage thing that i can use this type inside of the functions

Can someone help me out?

Regards

David!

 

0 Likes
1 Solution
DaGa_4352226
New Contributor II

i do have the project head file and i added the U to the macro but the error was there. What I have done it was to rename the function and that solved the problem... I do not why but it works!

But thanks for your help!

View solution in original post

0 Likes
2 Replies
KyTr_1955226
Valued Contributor

 

I can think of a couple things to check:

Firstly, if it's complaining specifically that the prototype in the header does not match the definition in the source file, check the order in which you are including your headers.  I believe uint16_t is defined in stdint.h, which iirc is included as part of the project.h generated by PSoC Creator on build.  Make sure you are including "project.h" before masterI2C.h. to ensure uint16_t is properly defined before it is used.  Alternatively, you could include <stdint.h> inside masterI2C.h, but I'm not sure if that's strictly "Good C Practice" including headers in other headers.

Does the error specifically occur when you attempt to call the function using one of those macro constants as an argument?  If so, does adding an 'u' or 'U' to the #define macro constant solve the issue?

I.E.

#define CMD_WATER (0x3608u)

I suspect maybe the compiler could possibly be treating the constant as int16_t without the u to specify it is unsigned.

 

 

0 Likes
DaGa_4352226
New Contributor II

i do have the project head file and i added the U to the macro but the error was there. What I have done it was to rename the function and that solved the problem... I do not why but it works!

But thanks for your help!

View solution in original post

0 Likes
Top labels