TM STM32F4xx Libraries  v1.0.0
Libraries for STM32F4xx devices from Tilen Majerle

SPI library for STM32F4xx - http://stm32f4-discovery.com/2014/04/library-05-spi-for-stm32f4xx/. More...

Modules

 TM_SPI_Typedefs
 Library Typedefs.
 
 TM_SPI_Macros
 Library defines.
 
 TM_SPI_Functions
 Library Functions.
 

Detailed Description

SPI library for STM32F4xx - http://stm32f4-discovery.com/2014/04/library-05-spi-for-stm32f4xx/.

It supports all 6 SPIs in master with 3 Lines Full Duplex mode

Default SPI settings

All six SPIs work the same principle by default:

Pinout
        |PINS PACK 1            |PINS PACK 2            |PINS PACK 3
SPIX    |MOSI   MISO    SCK     |MOSI   MISO    SCK     |MOSI   MISO    SCK
        |                                                    
SPI1    |PA7    PA6     PA5     |PB5    PB4     PB3     |
SPI2    |PC3    PC2     PB10    |PB15   PB14    PB13    |PI3    PI2     PI0
SPI3    |PB5    PB4     PB3     |PC12   PC11    PC10    |
SPI4    |PE6    PE5     PE2     |PE14   PE13    PE12    |
SPI5    |PF9    PF8     PF7     |PF11   PH7     PH6     |
SPI6    |PG14   PG12    PG13    |
In case these pins are not good for you, you can use
TM_SPI_PinsPack_Custom in function and callback function will be called,
where you can initialize your custom pinout for your SPI peripheral

Possible changes to each SPI. Set this defines in your defines.h file.

Change x with 1-6, to match your SPI
//Default prescaler
#define TM_SPIx_PRESCALER   SPI_BaudRatePrescaler_32
//Specify datasize
#define TM_SPIx_DATASIZE    SPI_DataSize_8b
//Specify which bit is first
#define TM_SPIx_FIRSTBIT    SPI_FirstBit_MSB
//Mode, master or slave
#define TM_SPIx_MASTERSLAVE SPI_Mode_Master
//Specify mode of operation, clock polarity and clock phase
#define TM_SPIx_MODE        TM_SPI_Mode_0
Changelog
 - Version 2.0
  - June 06, 2015
  - Added support for changing SPI data size on runtime
 
 Version 1.9
  - March 21, 2015
  - SPI Send BUG fixed
  
 Version 1.8
  - March 10, 2015
  - Updated to be mode independent of STD/HAL drivers
 
 Version 1.7
  - March 08, 2015
  - Added support for my new GPIO settings
 
 Version 1.6
  - March 05, 2015
  - Added 2 new functions, TM_SPI_InitFull and TM_SPI_GetPrescalerFromMaxFrequency()
 
 Version 1.5    
  - January 13, 2015
  - Added function TM_SPI_InitWithMode() to initialize SPI with custom SPI mode on the fly
 
 Version 1.4
  - November 09, 2014
  - Added methods for 16-bit SPI mode
 
 Version 1.3
  - September 14, 2014
  - Added additional pins for SPI2

 Version 1.0
  - First release
Dependencies
 - STM32F4xx
 - STM32F4xx RCC
 - STM32F4xx GPIO
 - STM32F4xx SPI
 - defines.h
 - attributes.h
 - TM GPIO