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