Files
@ a8dc1992dd1a
Branch filter:
Location: therm/system/spi.c - annotation
a8dc1992dd1a
792 B
text/plain
Added hgignore
0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b 0dfb00c8792b |
#include "stm32f0xx_hal_conf.h"
#include "stm32f0xx_hal_gpio_ex.h"
SPI_HandleTypeDef hspi1;
void spi_init()
{
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);
}
SPI_HandleTypeDef* spi_get()
{
return &hspi1;
}
// vim:softtabstop=4 shiftwidth=4 expandtab
|