0

I am using the Keil version 5 toolchain to program STM32F0 Series and I am not able to resolve the below-given error. I am sure I am missing something in it, but having a hard time finding it out.

> ..\Core\Src\max2871.c(169): error:  #18: expected a ")"
      if (((test_data[2] & ((1 << 28) | (1 << 27) | (1 << 26))) >> 26) == 0b110)

Thanks in Advance.

here is the complete function block:

void plo_check_lock_status(void)
{
    // Saves the status only if the muxout pin is set correctly.
    if (((test_data[2] & ((1 << 28) | (1 << 27) | (1 << 26))) >> 26) == 0b110)
        plo_buff_push(HAL_GPIO_ReadPin(PLO_MUXOUT_GPIO_Port, PLO_MUXOUT_Pin));
    else
        HAL_NVIC_DisableIRQ(EXTI0_1_IRQn);
}
Surya
  • 3
  • 3
  • Check the line above this one. – dbush Apr 06 '21 at 15:10
  • `if ((test_data[2] >> 26) & 7)` As far as I remember Keil does not support gcc extension `0bxxxx`. – 0___________ Apr 06 '21 at 15:13
  • void plo_check_lock_status(void) { // Saves the status only if the muxout pin is set correctly. if (((test_data[2] & ((1 << 28) | (1 << 27) | (1 << 26))) >> 26) == 0b110) plo_buff_push(HAL_GPIO_ReadPin(PLO_MUXOUT_GPIO_Port, PLO_MUXOUT_Pin)); else HAL_NVIC_DisableIRQ(EXTI0_1_IRQn); } – Surya Apr 06 '21 at 15:13
  • 2
    is the binary literals syntax (`0bxxx`) supported on this compiler? Replace the `0b110` with `0x6` and see if the error goes away. This syntax is not standard. – Eugene Sh. Apr 06 '21 at 15:13
  • You are correct, `0bxxx` BIN format was not supported by the compiler, So changed that to HEX format `0x6` and the issue is resolved. Thank you. – Surya Apr 06 '21 at 15:19
  • Hint: To find the exact location with a compiler that reports only the line number, you can temporarily split the line into multiple lines, placing each token (symbol, value, operator) on its own line. – the busybee Apr 06 '21 at 17:13

0 Answers0