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