#31 expression must have integral type

I’m having some problems with my C code and get the error in the title. First off, Uint16 is defined as:

typedef unsigned int    Uint16;

I use two variables in the function where I get the error, they are defined as:

static Uint16 gCommandSent = 0;
Uint16 gnRF_TX;

I call the function like this:

Transmit_nRF24L01(gnRF_TX, &gCommandSent);

and the function definition is like this:

void Transmit_nRF24L01(Uint16 nRF_TX,Uint16 *CommandSent)
{
    switch(CommandSent)
    {
    case 0:
        SpiaRegs.SPITXBUF = W_REGISTER | nRF24L01_CONFIG;
        *CommandSent = 1;
    case 1:
        SpiaRegs.SPITXBUF = CONFIG_TX;
        *CommandSent = 2;
    case 2:
        SpiaRegs.SPITXBUF = W_TX_PAYLOAD;
        *CommandSent = 3;
    case 3:
        SpiaRegs.SPITXBUF = nRF_TX;
        *CommandSent = 4;
    case 4:
        disable_TX();
        GpioDataRegs.GPBSET.bit.GPIO59 = 1;
        *CommandSent = 0;
    }
}

and lastly, the declaration in the shared header file looks like this:

void Transmit_nRF24L01(Uint16 nRF_TX,Uint16 *CommandSent);

I get the error on the line “switch(CommandSent)”. I need to be able to change the value of CommandSent so unfortunately I cannot remove the pointer… how do I get around this?

Thanks in advance!

Leave a Comment