This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Warning when declaring variable: 'Variable not used'

I'm trying to initialize I2C peripherals on my STM32 Discovery board and this is the function I've created to do so -

void I2C2_Initialize(void)
{

NVIC_InitTypeDef NVIC_InitStructure;
I2C_InitTypeDef I2C_InitStruct;

        I2C_InitStruct.I2C_ClockSpeed = 100000;
          I2C_InitStruct.I2C_Mode       = I2C_Mode_I2C;
          I2C_InitStruct.I2C_DutyCycle  = I2C_DutyCycle_2;
  //I2C_InitStruct.I2C_OwnAddress =
          I2C_InitStruct.I2C_Ack        = I2C_Ack_Enable;
        I2C_InitStruct.I2C_AcknowledgedAddress =  I2C_AcknowledgedAddress_7bit;

        I2C_AcknowledgeConfig(I2C2, ENABLE); //Enable Acknowledge for I2C2
        I2C_ITConfig(I2C2, I2C_IT_EVT, ENABLE); //Enable Event Interrupt Mask for I2C2
        I2C_Cmd(I2C2, ENABLE); //Enable I2C2 peripherals



                //! \Enable the I2Cx Interrupt
        NVIC_InitStructure.NVIC_IRQChannel = 33; //I2C2_EV_IRQn  #33 to enable I2C interrupt
                NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 5;
                NVIC_InitStructure.NVIC_IRQChannelSubPriority = 5;
                NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
                NVIC_Init(&NVIC_InitStructure);

}

I get the warning - #550D: variable "I2C_InitStruct" was declared but never used
This didn't come up in previous compilations. If anyone could help me with this it will be very much appreciated.