Using a defined constant inside HAL_UART_Transmit
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-08-20 3: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 ?
Labels:
- Labels:
-
STM32CubeIDE
-
UART-USART
10 REPLIES 10
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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 ) ;

- « Previous
-
- 1
- 2
- Next »