Files
@ 5bb33b7045ec
Branch filter:
Location: therm/spi.c - annotation
5bb33b7045ec
1.4 KiB
text/plain
Added optimized flags that remove unused functions from compilation output
49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf 49b0586d1fdf | #include "stm32l100c_discovery.h"
void init_spi(void)
{
SPI_InitTypeDef SPI_InitStructure;
// OLED IC
SPI_Cmd(SPI1, DISABLE);
SPI_InitStructure.SPI_Direction = SPI_Direction_1Line_Tx;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
SPI_InitStructure.SPI_CPOL = SPI_CPOL_High;
SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge;
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_4;
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_Init(SPI1, &SPI_InitStructure);
SPI_Cmd(SPI1, ENABLE); /* Enable the SPI */
// MAX IC
SPI_Cmd(SPI2, DISABLE);
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
SPI_InitStructure.SPI_DataSize = SPI_DataSize_16b; // Andysworkshop
SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low; // From andysworkshop
SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge; // same
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8;
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 7;
SPI_Init(SPI2, &SPI_InitStructure);
SPI_Cmd(SPI2, ENABLE); /* Enable the SPI */
}
// vim:softtabstop=4 shiftwidth=4 expandtab
|