Skip to main content
Takayoshi Ishii
Associate III
July 18, 2017
Solved

HAL_I2C_Master_Transmit() ''too few arguments''

  • July 18, 2017
  • 1 reply
  • 1904 views
Posted on July 18, 2017 at 05:08

Hello, I'm new with STM32 and this is the first time for using I2C on STM32.

My environment is Keil5+cubeMX4.22.

I can make the config by cube and I wrote following code, but couldn't compile it.

uint8_t c[5] ={'a', 'b', 'c', 'd', 'e'};

HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)0b00111110<<1, (uint8_t*)c, 1, 1000);

Build Output said 'too few arguments' but I think the function has just four arguments, that as I wrote.

All error output is like this,

*** Using Compiler 'V5.06 update 5 (build 528)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'

Build target 'moxom_a1'

compiling main.c...

../Src/main.c(102): error: #165: too few arguments in function call

HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)0b00111110<<1, (uint8_t*)c, 1, 1000);

../Src/main.c(102): error: #18: expected a ')'

HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)0b00111110<<1, (uint8_t*)c, 1, 1000);

../Src/main.c(100): warning: #177-D: variable 'c' was declared but never referenced

uint8_t c[5] ={'a', 'b', 'c', 'd', 'e'};

../Src/main.c: 1 warning, 2 errors

'moxom_a1\moxom_a1.axf' - 2 Error(s), 1 Warning(s).

Target not created.

Build Time Elapsed: 00:00:01
    This topic has been closed for replies.
    Best answer by Takayoshi Ishii
    Posted on July 18, 2017 at 05:22

    I solved it.

    The function can't recognize '0b' well I think.

    I changed,

    (uint16_t)0b00111110<<1,

    to

    (uint16_t)0x3E<<1,

    then I could compile it.

    Thank you.

    1 reply

    Takayoshi Ishii
    Takayoshi IshiiAuthorBest answer
    Associate III
    July 18, 2017
    Posted on July 18, 2017 at 05:22

    I solved it.

    The function can't recognize '0b' well I think.

    I changed,

    (uint16_t)0b00111110<<1,

    to

    (uint16_t)0x3E<<1,

    then I could compile it.

    Thank you.