STM8S/A Standard Peripherals Drivers: stm8s_spi.h File Reference

STM8S/A

stm8s_spi.h File Reference

This file contains all functions prototype and macros for the SPI peripheral. More...

#include "stm8s.h"

Go to the source code of this file.

Defines

#define IS_SPI_BAUDRATE_PRESCALER_OK(PRESCALER)
 Macro used by the assert_param function in order to check the baudrate values.
#define IS_SPI_CLEAR_FLAGS_OK(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_OK(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_OK(Interrupt)
 Macro used by the assert_param function in order to check the different sensitivity values for the Interrupts.
#define IS_SPI_CRC_OK(CRC)
 Macro used by the assert_param function in order to check the CRC Transmit/Receive.
#define IS_SPI_CRC_POLYNOMIAL_OK(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_OK(MODE)
 Macro used by the assert_param function in order to check the data direction mode values.
#define IS_SPI_DIRECTION_OK(DIRECTION)
 Macro used by the assert_param function in order to check the mode half duplex data direction values.
#define IS_SPI_FIRSTBIT_OK(BIT)
 Macro used by the assert_param function in order to check the first bit to be transmited values.
#define IS_SPI_FLAGS_OK(FLAG)
 Macro used by the assert_param function in order to check the different flags values.
#define IS_SPI_GET_IT_OK(ITPendingBit)
 Macro used by the assert_param function in order to check the different sensitivity values for the pending bit.
#define IS_SPI_MODE_OK(MODE)
 Macro used by the assert_param function in order to check the SPI Mode values.
#define IS_SPI_PHASE_OK(CLKPHA)
 Macro used by the assert_param function in order to check the phase values.
#define IS_SPI_POLARITY_OK(CLKPOL)
 Macro used by the assert_param function in order to check the polarity values.
#define IS_SPI_SLAVEMANAGEMENT_OK(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
}
 SPI BaudRate Prescaler Warning: element values correspond to BR bits position. More...
enum  SPI_ClockPhase_TypeDef { SPI_CLOCKPHASE_1EDGE = (uint8_t)0x00, SPI_CLOCKPHASE_2EDGE = (uint8_t)0x01 }
 SPI Clock Phase Warning: element values correspond to CPHA bit position. More...
enum  SPI_ClockPolarity_TypeDef { SPI_CLOCKPOLARITY_LOW = (uint8_t)0x00, SPI_CLOCKPOLARITY_HIGH = (uint8_t)0x02 }
 SPI Clock Polarity Warning: element values correspond to CPOL bit position. More...
enum  SPI_CRC_TypeDef { SPI_CRC_RX = (uint8_t)0x00, SPI_CRC_TX = (uint8_t)0x01 }
 SPI CRC Transmit/Receive. More...
enum  SPI_DataDirection_TypeDef { SPI_DATADIRECTION_2LINES_FULLDUPLEX = (uint8_t)0x00, SPI_DATADIRECTION_2LINES_RXONLY = (uint8_t)0x04, SPI_DATADIRECTION_1LINE_RX = (uint8_t)0x80, SPI_DATADIRECTION_1LINE_TX = (uint8_t)0xC0 }
 SPI data direction mode Warning: element values correspond to BDM, BDOE, RXONLY bits position. More...
enum  SPI_Direction_TypeDef { SPI_DIRECTION_RX = (uint8_t)0x00, SPI_DIRECTION_TX = (uint8_t)0x01 }
 SPI direction transmit/receive. More...
enum  SPI_FirstBit_TypeDef { SPI_FIRSTBIT_MSB = (uint8_t)0x00, SPI_FIRSTBIT_LSB = (uint8_t)0x80 }
 SPI Frame Format: MSB or LSB transmitted first Warning: element values correspond to LSBFIRST bit position. More...
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
}
 SPI flags definition - Warning : FLAG value = mapping position register. More...
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
}
 SPI_IT possible values Elements values convention: 0xYX X: Position of the corresponding Interrupt Y: ITPENDINGBIT position. More...
enum  SPI_Mode_TypeDef { SPI_MODE_MASTER = (uint8_t)0x04, SPI_MODE_SLAVE = (uint8_t)0x00 }
 SPI master/slave mode Warning: element values correspond to MSTR bit position. More...
enum  SPI_NSS_TypeDef { SPI_NSS_SOFT = (uint8_t)0x02, SPI_NSS_HARD = (uint8_t)0x00 }
 SPI Slave Select management Warning: element values correspond to LSBFIRST bit position. More...

Functions

void SPI_BiDirectionalLineConfig (SPI_Direction_TypeDef SPI_Direction)
 Selects the data transfer direction in bi-directional mode.
void SPI_CalculateCRCCmd (FunctionalState NewState)
 Enables or disables the CRC value calculation of the transferred bytes.
void SPI_ClearFlag (SPI_Flag_TypeDef SPI_FLAG)
 Clears the SPI flags.
void SPI_ClearITPendingBit (SPI_IT_TypeDef SPI_IT)
 Clears the interrupt pending bits.
void SPI_Cmd (FunctionalState NewState)
 Enables or disables the SPI peripheral.
void SPI_DeInit (void)
 Deinitializes the SPI peripheral registers to their default reset values.
uint8_t SPI_GetCRC (SPI_CRC_TypeDef SPI_CRC)
 Returns the transmit or the receive CRC register value.
uint8_t SPI_GetCRCPolynomial (void)
 Returns the CRC Polynomial register value.
FlagStatus SPI_GetFlagStatus (SPI_Flag_TypeDef SPI_FLAG)
 Checks whether the specified SPI flag is set or not.
ITStatus SPI_GetITStatus (SPI_IT_TypeDef SPI_IT)
 Checks whether the specified interrupt has occurred or not.
void SPI_Init (SPI_FirstBit_TypeDef FirstBit, SPI_BaudRatePrescaler_TypeDef BaudRatePrescaler, SPI_Mode_TypeDef Mode, SPI_ClockPolarity_TypeDef ClockPolarity, SPI_ClockPhase_TypeDef ClockPhase, SPI_DataDirection_TypeDef Data_Direction, SPI_NSS_TypeDef Slave_Management, uint8_t CRCPolynomial)
 Initializes the SPI according to the specified parameters.
void SPI_ITConfig (SPI_IT_TypeDef SPI_IT, FunctionalState NewState)
 Enables or disables the specified interrupts.
void SPI_NSSInternalSoftwareCmd (FunctionalState NewState)
 Configures internally by software the NSS pin.
uint8_t SPI_ReceiveData (void)
 Returns the most recent received data by the SPI peripheral.
void SPI_ResetCRC (void)
 Reset the Rx CRCR and Tx CRCR registers.
void SPI_SendData (uint8_t Data)
 Transmits a Data through the SPI peripheral.
void SPI_TransmitCRC (void)
 Enables the transmit of the CRC value.

Detailed Description

This file contains all functions prototype and macros for the SPI peripheral.

Author:
MCD Application Team
Version:
V2.3.0
Date:
16-June-2017
Attention:

© COPYRIGHT 2014 STMicroelectronics

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at:

http://www.st.com/software_license_agreement_liberty_v2

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file stm8s_spi.h.

STM8 Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM8 8-bit Microcontrollers platform visit www.st.com