diff --git a/spi.c b/spi.c --- a/spi.c +++ b/spi.c @@ -1,23 +1,24 @@ -void init_spi(void) +#include "stm32f0xx_hal_conf.h" +/* +void init_spi(SPI_HandleTypeDef* hspi1) { - SPI_HandleTypeDef hspi1; - 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_8; - 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); - + 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_8; + 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); +}*/ /* OLD: SPI_InitTypeDef SPI_InitStructure; @@ -51,6 +52,5 @@ void init_spi(void) SPI_Init(SPI2, &SPI_InitStructure); SPI_Cmd(SPI2, ENABLE); */ -} // vim:softtabstop=4 shiftwidth=4 expandtab