STM8L15x Standard Peripherals Drivers: stm8l15x_spi.h File Reference

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

stm8l15x_spi.h File Reference

This file contains all the functions prototypes for the SPI firmware library. More...

#include "stm8l15x.h"

Go to the source code of this file.

Defines

#define IS_SPI_BAUDRATE_PRESCALER(Prescaler)
 Macro used by the assert_param function in order to check the baudrate values.
#define IS_SPI_CLEAR_FLAG(Flag)
 Macro used by the assert_param function in order to check the different sensitivity values for the flag that can be cleared by writing 0.
#define IS_SPI_CLEAR_IT(ITPendingBit)
 Macro used by the assert_param function in order to check the different sensitivity values for the pending bit that can be cleared by writing 0.
#define IS_SPI_CONFIG_IT(Interrupt)
 Macro used by the assert_param function in order to check the different sensitivity values for the Interrupts.
#define IS_SPI_CRC(CRC)
 Macro used by the assert_param function in order to check the CRC Transmit/Receive.
#define IS_SPI_CRC_POLYNOMIAL(Polynomial)   ((Polynomial) > (uint8_t)0x00)
 Macro used by the assert_param function in order to check the different sensitivity values for the CRC polynomial.
#define IS_SPI_DATA_DIRECTION(Mode)
 Macro used by the assert_param function in order to check the data direction mode values.
#define IS_SPI_DIRECTION(Direction)
 Macro used by the assert_param function in order to check the mode half duplex data direction values.
#define IS_SPI_DMAREQ(DMAREQ)   ((((DMAREQ) & (uint16_t)0xFC) == 0x00) && ((DMAREQ) != 0x00))
 Macro used by the assert_param function in order to check the DMA transfer requests.
#define IS_SPI_FIRSTBIT(Bit)
 Macro used by the assert_param function in order to check the first bit to be transmitted values.
#define IS_SPI_FLAG(Flag)
 Macro used by the assert_param function in order to check the different flags values.
#define IS_SPI_GET_IT(ITPendingBit)
 Macro used by the assert_param function in order to check the different sensitivity values for the pending bit.
#define IS_SPI_MODE(Mode)
 Macro used by the assert_param function in order to check the SPI Mode values.
#define IS_SPI_PHASE(ClkPha)
 Macro used by the assert_param function in order to check the phase values.
#define IS_SPI_POLARITY(ClkPol)
 Macro used by the assert_param function in order to check the polarity values.
#define IS_SPI_SLAVEMANAGEMENT(NSS)
 Macro used by the assert_param function in order to check the NSS management values.

Enumerations

enum  SPI_BaudRatePrescaler_TypeDef {
  SPI_BaudRatePrescaler_2 = (uint8_t)0x00, SPI_BaudRatePrescaler_4 = (uint8_t)0x08, SPI_BaudRatePrescaler_8 = (uint8_t)0x10, SPI_BaudRatePrescaler_16 = (uint8_t)0x18,
  SPI_BaudRatePrescaler_32 = (uint8_t)0x20, SPI_BaudRatePrescaler_64 = (uint8_t)0x28, SPI_BaudRatePrescaler_128 = (uint8_t)0x30, SPI_BaudRatePrescaler_256 = (uint8_t)0x38
}
enum  SPI_CPHA_TypeDef { SPI_CPHA_1Edge = (uint8_t)0x00, SPI_CPHA_2Edge = (uint8_t)0x01 }
enum  SPI_CPOL_TypeDef { SPI_CPOL_Low = (uint8_t)0x00, SPI_CPOL_High = (uint8_t)0x02 }
enum  SPI_CRC_TypeDef { SPI_CRC_RX = (uint8_t)0x00, SPI_CRC_TX = (uint8_t)0x01 }
enum  SPI_Direction_TypeDef { SPI_Direction_Rx = (uint8_t)0x00, SPI_Direction_Tx = (uint8_t)0x01 }
enum  SPI_DirectionMode_TypeDef { SPI_Direction_2Lines_FullDuplex = (uint8_t)0x00, SPI_Direction_2Lines_RxOnly = (uint8_t)0x04, SPI_Direction_1Line_Rx = (uint8_t)0x80, SPI_Direction_1Line_Tx = (uint8_t)0xC0 }
enum  SPI_DMAReq_TypeDef { SPI_DMAReq_RX = (uint8_t)0x01, SPI_DMAReq_TX = (uint8_t)0x02 }
enum  SPI_FirstBit_TypeDef { SPI_FirstBit_MSB = (uint8_t)0x00, SPI_FirstBit_LSB = (uint8_t)0x80 }
enum  SPI_FLAG_TypeDef {
  SPI_FLAG_BSY = (uint8_t)0x80, SPI_FLAG_OVR = (uint8_t)0x40, SPI_FLAG_MODF = (uint8_t)0x20, SPI_FLAG_CRCERR = (uint8_t)0x10,
  SPI_FLAG_WKUP = (uint8_t)0x08, SPI_FLAG_TXE = (uint8_t)0x02, SPI_FLAG_RXNE = (uint8_t)0x01
}
enum  SPI_IT_TypeDef {
  SPI_IT_WKUP = (uint8_t)0x34, SPI_IT_OVR = (uint8_t)0x65, SPI_IT_MODF = (uint8_t)0x55, SPI_IT_CRCERR = (uint8_t)0x45,
  SPI_IT_TXE = (uint8_t)0x17, SPI_IT_RXNE = (uint8_t)0x06, SPI_IT_ERR = (uint8_t)0x05
}
enum  SPI_Mode_TypeDef { SPI_Mode_Master = (uint8_t)0x04, SPI_Mode_Slave = (uint8_t)0x00 }
enum  SPI_NSS_TypeDef { SPI_NSS_Soft = (uint8_t)0x02, SPI_NSS_Hard = (uint8_t)0x00 }

Functions

void SPI_BiDirectionalLineConfig (SPI_TypeDef *SPIx, SPI_Direction_TypeDef SPI_Direction)
 Selects the data transfer direction in Bi-directional mode.
void SPI_CalculateCRCCmd (SPI_TypeDef *SPIx, FunctionalState NewState)
 Enables or disables the CRC value calculation of the transferred bytes.
void SPI_ClearFlag (SPI_TypeDef *SPIx, SPI_FLAG_TypeDef SPI_FLAG)
 Clears the SPI flags.
void SPI_ClearITPendingBit (SPI_TypeDef *SPIx, SPI_IT_TypeDef SPI_IT)
 Clears the interrupt pending bits.
void SPI_Cmd (SPI_TypeDef *SPIx, FunctionalState NewState)
 Enables or disables the SPI peripheral.
void SPI_DeInit (SPI_TypeDef *SPIx)
 Deinitializes the SPI peripheral registers to their default reset values.
void SPI_DMACmd (SPI_TypeDef *SPIx, SPI_DMAReq_TypeDef SPI_DMAReq, FunctionalState NewState)
 Enables or disables the SPI DMA interface.
uint8_t SPI_GetCRC (SPI_TypeDef *SPIx, SPI_CRC_TypeDef SPI_CRC)
 Returns the transmit or the receive CRC register value.
uint8_t SPI_GetCRCPolynomial (SPI_TypeDef *SPIx)
 Returns the CRC Polynomial register value.
FlagStatus SPI_GetFlagStatus (SPI_TypeDef *SPIx, SPI_FLAG_TypeDef SPI_FLAG)
 Checks whether the specified SPI flag is set or not.
ITStatus SPI_GetITStatus (SPI_TypeDef *SPIx, SPI_IT_TypeDef SPI_IT)
 Checks whether the specified interrupt has occurred or not.
void SPI_Init (SPI_TypeDef *SPIx, SPI_FirstBit_TypeDef SPI_FirstBit, SPI_BaudRatePrescaler_TypeDef SPI_BaudRatePrescaler, SPI_Mode_TypeDef SPI_Mode, SPI_CPOL_TypeDef SPI_CPOL, SPI_CPHA_TypeDef SPI_CPHA, SPI_DirectionMode_TypeDef SPI_Data_Direction, SPI_NSS_TypeDef SPI_Slave_Management, uint8_t CRCPolynomial)
 Initializes the SPI according to the specified parameters.
void SPI_ITConfig (SPI_TypeDef *SPIx, SPI_IT_TypeDef SPI_IT, FunctionalState NewState)
 Enables or disables the specified interrupts.
void SPI_NSSInternalSoftwareCmd (SPI_TypeDef *SPIx, FunctionalState NewState)
 Configures internally by software the NSS pin.
uint8_t SPI_ReceiveData (SPI_TypeDef *SPIx)
 Returns the most recent received data by the SPI peripheral.
void SPI_ResetCRC (SPI_TypeDef *SPIx)
 Reset the Rx CRCR and Tx CRCR registers.
void SPI_SendData (SPI_TypeDef *SPIx, uint8_t Data)
 Transmits a Data through the SPI peripheral.
void SPI_TransmitCRC (SPI_TypeDef *SPIx)
 Enables the transmit of the CRC value.

Detailed Description

This file contains all the functions prototypes for the SPI firmware library.

Author:
MCD Application Team
Version:
V1.5.0
Date:
13-May-2011
Attention:

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

© COPYRIGHT 2011 STMicroelectronics

Definition in file stm8l15x_spi.h.

STM8S Firmware Library: Overview

 

 

 

For complete documentation on STM8L15x 8-bit microcontrollers platform visit www.st.com