STMicroelectronics-CentralLabs / ST_Drone_FCU_F401

Toy drone project for STEVAL-FCU001V1 flight controller unit demo board.
Other
157 stars 114 forks source link

Add comments to SPI Half-Duplex code #19

Open sgauche opened 2 years ago

sgauche commented 2 years ago

Hi,

Could you add comments to the code that explain the reason for the 67 __asm("dsb\n"); in the SPI_Read function. The comment that is there suggests it has to do with SPI clock timing, but a comment explaining how 67 was derived would be very helpful.

https://github.com/STMicroelectronics-CentralLabs/ST_Drone_FCU_F401/blob/master/STM32%20FW%20Project/Official%20release%20-%20170120/Drivers/BSP/STEVAL_FCU001_V1/steval_fcu001_v1.c#L523-L533

SPI_Read_nBytes also has 2 __DSB(); calls and it would be helpful to add a comment on why 2 DSB's were used.

https://github.com/STMicroelectronics-CentralLabs/ST_Drone_FCU_F401/blob/master/STM32%20FW%20Project/Official%20release%20-%20170120/Drivers/BSP/STEVAL_FCU001_V1/steval_fcu001_v1.c#L611-L612

Thanks!