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?

Blup1980
6,9603 gold badges30 silver badges49 bronze badges
asked Jan 10, 2019 at 9:09
\$\endgroup\$
2
  • \$\begingroup\$ Look correct to me. \$\endgroup\$ Commented 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\$ Commented 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.

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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.