2017-07-17 08:08 PM
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:01Solved! Go to Solution.
2017-07-17 08:22 PM
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.
2017-07-17 08:22 PM
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.