0
\$\begingroup\$

I am using the board STM32F3 and I am trying to establish I2C communication between the microcontroller and the accelerometer LSM303DLHC by using the HAL functions. This is the code:

uint8_t IC[4];

#define acc 0b0011001

IC[0] = 0x20;           // register adress

IC[1] = 0x87;          // data to write

HAL_I2C_Master_Transmit(&hi2c1, acc<<1, IC, 2, 10);

When I compile, I obtain the following errors:

error: #165: too few arguments in function call

error: #18: expected a ")"

I have no idea how to debug this code, can someone help me?

\$\endgroup\$
2
  • \$\begingroup\$ Look correct to me. \$\endgroup\$
    – Long Pham
    Jan 10, 2019 at 9:42
  • 3
    \$\begingroup\$ The error is probably not in the posted code. Include the code for the whole function where the compiler error appears, including all variable declarations and #includes. Smells like some stray ( or semicolon. \$\endgroup\$
    – Lundin
    Jan 10, 2019 at 9:53

1 Answer 1

1
\$\begingroup\$

Your compiler does not support binary literals. Change the define to hex or decimal.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you! It was exactly that problem and now it is solved ;) \$\endgroup\$
    – emdezla
    Jan 12, 2019 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.