AnsweredAssumed Answered

STM32CubeMx HAL_SPI_Receive ?

Question asked by H.Rick on Oct 6, 2015
Latest reply on Nov 28, 2015 by H.Rick
Guys,

I want to send a command and then retrieve the output on MOSI line ...

Is the right way doing it ?
int resultvalue = 0;
 
uint8_t data7[2] = { VS_READ_COMMAND, addressbyte };
HAL_SPI_Transmit(&hspi1,data7,2,1000);
 
then :
uint8_t data8[1] = {0x00}; <=== is it declared properly ?
 
resultvalue = HAL_SPI_Receive(&hspi1,data8,1,1000);
resultvalue <<= 8;
 resultvalue += HAL_SPI_Receive(&hspi1,data8,1,1000);
 
return resultvalue;

Thanks a lot

Outcomes