Question
STM32CubeMx HAL_SPI_Receive ?
Posted on October 06, 2015 at 23:59
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