2016-02-02 6:34 AM
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); } thanks2016-02-02 7:10 AM
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.2016-02-02 12:47 PM
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