2020-08-20 03:32 AM
Hello,
I'm using STM32 with STM32CubeIDE
This is my code:
#define SOME_DATA 0x01
HAL_UART_Transmit ( & huart6 , SOME_DATA , 1 , 1000 ) ;
The compiler issues the following warning :
passing argument 2 of 'HAL_UART_Transmit' makes pointer from integer without a cast [-Wint-conversion]
What should I do to fix it ?
2023-11-13 10:38 AM
you can pass the address directly too like this
uint8_t SOME_DATA = 0x01;
HAL_UART_Transmit ( & huart6 , &SOME_DATA , 1 , 1000 ) ;
Or you can also force it a bit with on the fly casting like this
SOME_DATA = 0x01;
HAL_UART_Transmit ( & huart6 , (uint8_t *)(&SOME_DATA) , 1 , 1000 ) ;