#167: argument of type ''const BYTE *'' is incompatible with parameter of type ''uint8_t *''??
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-02-02 6:34 AM
Posted on February 02, 2016 at 15:34
Guys,
Is there anyway to convert Byte to uint8_t ? I got this error : ..\Src\user_diskio.c(171): error: #167: argument of type ''const BYTE *'' is incompatible with parameter of type ''uint8_t *''static
void xmit_spi_multi ( const BYTE *p, /* Data block to be sent */ UINT cnt ) { while(HAL_SPI_GetState(&hspi2) != HAL_SPI_STATE_READY); HAL_SPI_Transmit(&hspi2,p,cnt,100); } thanks
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-02-02 7:10 AM
Posted on February 02, 2016 at 16:10
Is the problem BYTE vs. uint8_t or const?
HAL_StatusTypeDef HAL_SPI_Transmit(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout); HAL_SPI_Transmit() does not expect a pointer to const data. IMO this is a bug in the library and I really hope thatHAL_SPI_Transmit() does not modify the data that pData points to. I would just cast away constness:HAL_SPI_Transmit(&hspi2,(BYTE*)p,cnt,100); or
HAL_SPI_Transmit(&hspi2,(uint8_t *)p,cnt,100); Hope this works and hope this helps.Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-02-02 12:47 PM
Posted on February 02, 2016 at 21:47
It does the job....hopefully the code will run...
it can be compiled, but I will see if it's running or not... I'll keep posting Thanks