annotate Common/Drivers/STM32F4xx_HAL_DRIVER_v120/Inc/stm32f4xx_hal_spi.h @ 45:219943ef9dc0

Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
author Ideenmodellierer
date Sun, 29 Jul 2018 18:07:52 +0200
parents 5f11787b4f42
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @file stm32f4xx_hal_spi.h
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @author MCD Application Team
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @version V1.2.0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 26-December-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @brief Header file of SPI HAL module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 * Redistribution and use in source and binary forms, with or without modification,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 * are permitted provided that the following conditions are met:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 * 1. Redistributions of source code must retain the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 * this list of conditions and the following disclaimer.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 * this list of conditions and the following disclaimer in the documentation
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 * and/or other materials provided with the distribution.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 * may be used to endorse or promote products derived from this software
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 * without specific prior written permission.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 /* Define to prevent recursive inclusion -------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 #ifndef __STM32F4xx_HAL_SPI_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 #define __STM32F4xx_HAL_SPI_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 extern "C" {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 #include "stm32f4xx_hal_def.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 /** @addtogroup STM32F4xx_HAL_Driver
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 /** @addtogroup SPI
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 /* Exported types ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 /** @defgroup SPI_Exported_Types SPI Exported Types
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 * @brief SPI Configuration Structure definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 uint32_t Mode; /*!< Specifies the SPI operating mode.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 This parameter can be a value of @ref SPI_mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 uint32_t Direction; /*!< Specifies the SPI Directional mode state.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 This parameter can be a value of @ref SPI_Direction_mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 uint32_t DataSize; /*!< Specifies the SPI data size.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 This parameter can be a value of @ref SPI_data_size */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 uint32_t CLKPolarity; /*!< Specifies the serial clock steady state.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 This parameter can be a value of @ref SPI_Clock_Polarity */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 uint32_t CLKPhase; /*!< Specifies the clock active edge for the bit capture.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 This parameter can be a value of @ref SPI_Clock_Phase */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 uint32_t NSS; /*!< Specifies whether the NSS signal is managed by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 hardware (NSS pin) or by software using the SSI bit.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 This parameter can be a value of @ref SPI_Slave_Select_management */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 uint32_t BaudRatePrescaler; /*!< Specifies the Baud Rate prescaler value which will be
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 used to configure the transmit and receive SCK clock.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 This parameter can be a value of @ref SPI_BaudRate_Prescaler
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 @note The communication clock is derived from the master
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 clock. The slave clock does not need to be set */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 uint32_t FirstBit; /*!< Specifies whether data transfers start from MSB or LSB bit.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 This parameter can be a value of @ref SPI_MSB_LSB_transmission */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 uint32_t TIMode; /*!< Specifies if the TI mode is enabled or not.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 This parameter can be a value of @ref SPI_TI_mode */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 uint32_t CRCCalculation; /*!< Specifies if the CRC calculation is enabled or not.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 This parameter can be a value of @ref SPI_CRC_Calculation */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 uint32_t CRCPolynomial; /*!< Specifies the polynomial used for the CRC calculation.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 This parameter must be a number between Min_Data = 0 and Max_Data = 65535 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 }SPI_InitTypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 * @brief HAL SPI State structure definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 typedef enum
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 HAL_SPI_STATE_RESET = 0x00, /*!< SPI not yet initialized or disabled */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 HAL_SPI_STATE_READY = 0x01, /*!< SPI initialized and ready for use */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 HAL_SPI_STATE_BUSY = 0x02, /*!< SPI process is ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 HAL_SPI_STATE_BUSY_TX = 0x12, /*!< Data Transmission process is ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 HAL_SPI_STATE_BUSY_RX = 0x22, /*!< Data Reception process is ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 HAL_SPI_STATE_BUSY_TX_RX = 0x32, /*!< Data Transmission and Reception process is ongoing */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 HAL_SPI_STATE_ERROR = 0x03 /*!< SPI error state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 }HAL_SPI_StateTypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 * @brief SPI handle Structure definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 typedef struct __SPI_HandleTypeDef
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 SPI_TypeDef *Instance; /* SPI registers base address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 SPI_InitTypeDef Init; /* SPI communication parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 uint8_t *pTxBuffPtr; /* Pointer to SPI Tx transfer Buffer */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 uint16_t TxXferSize; /* SPI Tx transfer size */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 uint16_t TxXferCount; /* SPI Tx Transfer Counter */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 uint8_t *pRxBuffPtr; /* Pointer to SPI Rx transfer Buffer */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 uint16_t RxXferSize; /* SPI Rx transfer size */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 uint16_t RxXferCount; /* SPI Rx Transfer Counter */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 DMA_HandleTypeDef *hdmatx; /* SPI Tx DMA handle parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 DMA_HandleTypeDef *hdmarx; /* SPI Rx DMA handle parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 void (*RxISR)(struct __SPI_HandleTypeDef * hspi); /* function pointer on Rx ISR */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 void (*TxISR)(struct __SPI_HandleTypeDef * hspi); /* function pointer on Tx ISR */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 HAL_LockTypeDef Lock; /* SPI locking object */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 __IO HAL_SPI_StateTypeDef State; /* SPI communication state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 __IO uint32_t ErrorCode; /* SPI Error code */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 }SPI_HandleTypeDef;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 /* Exported constants --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 /** @defgroup SPI_Exported_Constants SPI Exported Constants
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 /** @defgroup SPI_Error_Code SPI Error Code
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 * @brief SPI Error Code
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 #define HAL_SPI_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 #define HAL_SPI_ERROR_MODF ((uint32_t)0x00000001) /*!< MODF error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 #define HAL_SPI_ERROR_CRC ((uint32_t)0x00000002) /*!< CRC error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 #define HAL_SPI_ERROR_OVR ((uint32_t)0x00000004) /*!< OVR error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 #define HAL_SPI_ERROR_FRE ((uint32_t)0x00000008) /*!< FRE error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 #define HAL_SPI_ERROR_DMA ((uint32_t)0x00000010) /*!< DMA transfer error */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 #define HAL_SPI_ERROR_FLAG ((uint32_t)0x00000010) /*!< Flag: RXNE,TXE, BSY */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 /** @defgroup SPI_mode SPI Mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 #define SPI_MODE_SLAVE ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 #define SPI_MODE_MASTER (SPI_CR1_MSTR | SPI_CR1_SSI)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 /** @defgroup SPI_Direction_mode SPI Direction Mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 #define SPI_DIRECTION_2LINES ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 #define SPI_DIRECTION_2LINES_RXONLY SPI_CR1_RXONLY
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 #define SPI_DIRECTION_1LINE SPI_CR1_BIDIMODE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 /** @defgroup SPI_data_size SPI Data Size
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 #define SPI_DATASIZE_8BIT ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 #define SPI_DATASIZE_16BIT SPI_CR1_DFF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 /** @defgroup SPI_Clock_Polarity SPI Clock Polarity
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 #define SPI_POLARITY_LOW ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 #define SPI_POLARITY_HIGH SPI_CR1_CPOL
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 /** @defgroup SPI_Clock_Phase SPI Clock Phase
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 #define SPI_PHASE_1EDGE ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 #define SPI_PHASE_2EDGE SPI_CR1_CPHA
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 /** @defgroup SPI_Slave_Select_management SPI Slave Select Management
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 #define SPI_NSS_SOFT SPI_CR1_SSM
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 #define SPI_NSS_HARD_INPUT ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 #define SPI_NSS_HARD_OUTPUT ((uint32_t)0x00040000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 /** @defgroup SPI_BaudRate_Prescaler SPI BaudRate Prescaler
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 #define SPI_BAUDRATEPRESCALER_2 ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 #define SPI_BAUDRATEPRESCALER_4 ((uint32_t)0x00000008)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 #define SPI_BAUDRATEPRESCALER_8 ((uint32_t)0x00000010)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 #define SPI_BAUDRATEPRESCALER_16 ((uint32_t)0x00000018)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 #define SPI_BAUDRATEPRESCALER_32 ((uint32_t)0x00000020)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 #define SPI_BAUDRATEPRESCALER_64 ((uint32_t)0x00000028)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 #define SPI_BAUDRATEPRESCALER_128 ((uint32_t)0x00000030)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 #define SPI_BAUDRATEPRESCALER_256 ((uint32_t)0x00000038)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 /** @defgroup SPI_MSB_LSB_transmission SPI MSB LSB Transsmission
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 #define SPI_FIRSTBIT_MSB ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 #define SPI_FIRSTBIT_LSB SPI_CR1_LSBFIRST
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 /** @defgroup SPI_TI_mode SPI TI Mode
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 #define SPI_TIMODE_DISABLE ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 #define SPI_TIMODE_ENABLE SPI_CR2_FRF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 /** @defgroup SPI_CRC_Calculation SPI CRC Calculation
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 #define SPI_CRCCALCULATION_DISABLE ((uint32_t)0x00000000)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 #define SPI_CRCCALCULATION_ENABLE SPI_CR1_CRCEN
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 /** @defgroup SPI_Interrupt_definition SPI Interrupt Definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 #define SPI_IT_TXE SPI_CR2_TXEIE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 #define SPI_IT_RXNE SPI_CR2_RXNEIE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 #define SPI_IT_ERR SPI_CR2_ERRIE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 /** @defgroup SPI_Flags_definition SPI Flags Definition
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 #define SPI_FLAG_RXNE SPI_SR_RXNE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 #define SPI_FLAG_TXE SPI_SR_TXE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 #define SPI_FLAG_CRCERR SPI_SR_CRCERR
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 #define SPI_FLAG_MODF SPI_SR_MODF
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 #define SPI_FLAG_OVR SPI_SR_OVR
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297 #define SPI_FLAG_BSY SPI_SR_BSY
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298 #define SPI_FLAG_FRE SPI_SR_FRE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 /* Exported macro ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 /** @defgroup SPI_Exported_Macros SPI Exported Macros
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 /** @brief Reset SPI handle state
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 * @param __HANDLE__: specifies the SPI handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 * This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 #define __HAL_SPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SPI_STATE_RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 /** @brief Enable or disable the specified SPI interrupts.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 * @param __HANDLE__: specifies the SPI handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 * This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 * @param __INTERRUPT__: specifies the interrupt source to enable or disable.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 * This parameter can be one of the following values:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 * @arg SPI_IT_TXE: Tx buffer empty interrupt enable
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324 * @arg SPI_IT_RXNE: RX buffer not empty interrupt enable
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 * @arg SPI_IT_ERR: Error interrupt enable
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 #define __HAL_SPI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 |= (__INTERRUPT__))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 #define __HAL_SPI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 &= (~(__INTERRUPT__)))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 /** @brief Check if the specified SPI interrupt source is enabled or disabled.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 * @param __HANDLE__: specifies the SPI handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 * This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 * @param __INTERRUPT__: specifies the SPI interrupt source to check.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 * This parameter can be one of the following values:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 * @arg SPI_IT_TXE: Tx buffer empty interrupt enable
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 * @arg SPI_IT_RXNE: RX buffer not empty interrupt enable
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 * @arg SPI_IT_ERR: Error interrupt enable
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 * @retval The new state of __IT__ (TRUE or FALSE).
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 #define __HAL_SPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 /** @brief Check whether the specified SPI flag is set or not.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 * @param __HANDLE__: specifies the SPI handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 * This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 * @param __FLAG__: specifies the flag to check.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347 * This parameter can be one of the following values:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 * @arg SPI_FLAG_RXNE: Receive buffer not empty flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 * @arg SPI_FLAG_TXE: Transmit buffer empty flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 * @arg SPI_FLAG_CRCERR: CRC error flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351 * @arg SPI_FLAG_MODF: Mode fault flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 * @arg SPI_FLAG_OVR: Overrun flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353 * @arg SPI_FLAG_BSY: Busy flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 * @arg SPI_FLAG_FRE: Frame format error flag
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 * @retval The new state of __FLAG__ (TRUE or FALSE).
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 #define __HAL_SPI_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 /** @brief Clear the SPI CRCERR pending flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 * @param __HANDLE__: specifies the SPI handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 * This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 #define __HAL_SPI_CLEAR_CRCERRFLAG(__HANDLE__) ((__HANDLE__)->Instance->SR = ~(SPI_FLAG_CRCERR))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 /** @brief Clear the SPI MODF pending flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 * @param __HANDLE__: specifies the SPI handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 * This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 #define __HAL_SPI_CLEAR_MODFFLAG(__HANDLE__) \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 do{ \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373 __IO uint32_t tmpreg; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374 tmpreg = (__HANDLE__)->Instance->SR; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 (__HANDLE__)->Instance->CR1 &= (~SPI_CR1_SPE); \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 UNUSED(tmpreg); \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377 } while(0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 /** @brief Clear the SPI OVR pending flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 * @param __HANDLE__: specifies the SPI handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 * This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384 #define __HAL_SPI_CLEAR_OVRFLAG(__HANDLE__) \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385 do{ \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 __IO uint32_t tmpreg; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 tmpreg = (__HANDLE__)->Instance->DR; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388 tmpreg = (__HANDLE__)->Instance->SR; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389 UNUSED(tmpreg); \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390 } while(0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392 /** @brief Clear the SPI FRE pending flag.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393 * @param __HANDLE__: specifies the SPI handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 * This parameter can be SPI where x: 1, 2, or 3 to select the SPI peripheral.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397 #define __HAL_SPI_CLEAR_FREFLAG(__HANDLE__) \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 do{ \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 __IO uint32_t tmpreg; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400 tmpreg = (__HANDLE__)->Instance->SR; \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 UNUSED(tmpreg); \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402 }while(0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 /** @brief Enable SPI
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405 * @param __HANDLE__: specifies the SPI Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408 #define __HAL_SPI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= SPI_CR1_SPE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410 /** @brief Disable SPI
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411 * @param __HANDLE__: specifies the SPI Handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414 #define __HAL_SPI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~SPI_CR1_SPE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420 /** @addtogroup SPI_Exported_Functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424 /** @addtogroup SPI_Exported_Functions_Group1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427 /* Initialization/de-initialization functions **********************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428 HAL_StatusTypeDef HAL_SPI_Init(SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429 HAL_StatusTypeDef HAL_SPI_DeInit (SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
430 void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
431 void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
432 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436 /** @addtogroup SPI_Exported_Functions_Group2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439 /* I/O operation functions *****************************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440 HAL_StatusTypeDef HAL_SPI_Transmit(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 HAL_StatusTypeDef HAL_SPI_Receive(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size, uint32_t Timeout);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442 HAL_StatusTypeDef HAL_SPI_TransmitReceive(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443 HAL_StatusTypeDef HAL_SPI_Transmit_IT(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 HAL_StatusTypeDef HAL_SPI_Receive_IT(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445 HAL_StatusTypeDef HAL_SPI_TransmitReceive_IT(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446 HAL_StatusTypeDef HAL_SPI_Transmit_DMA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447 HAL_StatusTypeDef HAL_SPI_Receive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448 HAL_StatusTypeDef HAL_SPI_TransmitReceive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 HAL_StatusTypeDef HAL_SPI_DMAPause(SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450 HAL_StatusTypeDef HAL_SPI_DMAResume(SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451 HAL_StatusTypeDef HAL_SPI_DMAStop(SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453 void HAL_SPI_IRQHandler(SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
454 void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455 void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456 void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457 void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458 void HAL_SPI_TxHalfCpltCallback(SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
459 void HAL_SPI_RxHalfCpltCallback(SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460 void HAL_SPI_TxRxHalfCpltCallback(SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465 /** @addtogroup SPI_Exported_Functions_Group3
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468 /* Peripheral State and Control functions **************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 HAL_SPI_StateTypeDef HAL_SPI_GetState(SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470 uint32_t HAL_SPI_GetError(SPI_HandleTypeDef *hspi);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480 /* Private types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 /* Private constants ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483 /** @defgroup SPI_Private_Constants SPI Private Constants
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
485 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
489
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
490 /* Private macros ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
491 /** @defgroup SPI_Private_Macros SPI Private Macros
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
492 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
494
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
495 #define IS_SPI_MODE(MODE) (((MODE) == SPI_MODE_SLAVE) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
496 ((MODE) == SPI_MODE_MASTER))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
497
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
498
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
499 #define IS_SPI_DIRECTION_MODE(MODE) (((MODE) == SPI_DIRECTION_2LINES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
500 ((MODE) == SPI_DIRECTION_2LINES_RXONLY) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
501 ((MODE) == SPI_DIRECTION_1LINE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
502
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
503 #define IS_SPI_DIRECTION_2LINES_OR_1LINE(MODE) (((MODE) == SPI_DIRECTION_2LINES) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
504 ((MODE) == SPI_DIRECTION_1LINE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
505
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
506 #define IS_SPI_DIRECTION_2LINES(MODE) ((MODE) == SPI_DIRECTION_2LINES)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
507
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
508 #define IS_SPI_DATASIZE(DATASIZE) (((DATASIZE) == SPI_DATASIZE_16BIT) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
509 ((DATASIZE) == SPI_DATASIZE_8BIT))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
510
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
511 #define IS_SPI_CPOL(CPOL) (((CPOL) == SPI_POLARITY_LOW) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
512 ((CPOL) == SPI_POLARITY_HIGH))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
513
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
514 #define IS_SPI_CPHA(CPHA) (((CPHA) == SPI_PHASE_1EDGE) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
515 ((CPHA) == SPI_PHASE_2EDGE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
516
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
517 #define IS_SPI_NSS(NSS) (((NSS) == SPI_NSS_SOFT) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
518 ((NSS) == SPI_NSS_HARD_INPUT) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
519 ((NSS) == SPI_NSS_HARD_OUTPUT))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
520
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
521 #define IS_SPI_BAUDRATE_PRESCALER(PRESCALER) (((PRESCALER) == SPI_BAUDRATEPRESCALER_2) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
522 ((PRESCALER) == SPI_BAUDRATEPRESCALER_4) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
523 ((PRESCALER) == SPI_BAUDRATEPRESCALER_8) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524 ((PRESCALER) == SPI_BAUDRATEPRESCALER_16) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
525 ((PRESCALER) == SPI_BAUDRATEPRESCALER_32) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
526 ((PRESCALER) == SPI_BAUDRATEPRESCALER_64) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
527 ((PRESCALER) == SPI_BAUDRATEPRESCALER_128) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
528 ((PRESCALER) == SPI_BAUDRATEPRESCALER_256))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
529
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
530 #define IS_SPI_FIRST_BIT(BIT) (((BIT) == SPI_FIRSTBIT_MSB) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
531 ((BIT) == SPI_FIRSTBIT_LSB))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
532
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
533 #define IS_SPI_TIMODE(MODE) (((MODE) == SPI_TIMODE_DISABLE) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
534 ((MODE) == SPI_TIMODE_ENABLE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
535
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
536 #define IS_SPI_CRC_CALCULATION(CALCULATION) (((CALCULATION) == SPI_CRCCALCULATION_DISABLE) || \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
537 ((CALCULATION) == SPI_CRCCALCULATION_ENABLE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
538
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
539 #define IS_SPI_CRC_POLYNOMIAL(POLYNOMIAL) (((POLYNOMIAL) >= 0x1) && ((POLYNOMIAL) <= 0xFFFF))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
540
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
541 #define SPI_1LINE_TX(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= SPI_CR1_BIDIOE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
542
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
543 #define SPI_1LINE_RX(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~SPI_CR1_BIDIOE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
544
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
545 #define SPI_RESET_CRC(__HANDLE__) do{(__HANDLE__)->Instance->CR1 &= (~SPI_CR1_CRCEN);\
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
546 (__HANDLE__)->Instance->CR1 |= SPI_CR1_CRCEN;}while(0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
547 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
548 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
549 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
550
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
551 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
552 /** @defgroup SPI_Private_Functions SPI Private Functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
553 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
554 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
555
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
556 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
557 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
558 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
559
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
560 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
561 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
562 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
563
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
564 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
565 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
566 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
567
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
568
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
569 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
570 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
571 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
572
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
573 #endif /* __STM32F4xx_HAL_SPI_H */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
574
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
575 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/