Files @ 58f85a2f51f0
Branch filter:

Location: therm/spi.c

Ethan Zonca
Remove wait on USB busy. Note that previous commit introduced a fairly nasty bug where displayed temp is only updated if USB CDC is connected

#include "stm32f0xx_hal_conf.h"
#include "stm32f0xx_hal_gpio_ex.h"
extern SPI_HandleTypeDef hspi1;

void init_spi()
{
    hspi1.Instance = SPI1;
    hspi1.Init.Mode = SPI_MODE_MASTER;
    hspi1.Init.Direction = SPI_DIRECTION_2LINES;
    hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
    hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
    hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
    hspi1.Init.NSS = SPI_NSS_SOFT;
    hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;
    hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
    hspi1.Init.TIMode = SPI_TIMODE_DISABLED;
    hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLED;
    hspi1.Init.NSSPMode = SPI_NSS_PULSE_ENABLED;
    HAL_SPI_Init(&hspi1);
}    
    
// vim:softtabstop=4 shiftwidth=4 expandtab