mbed library sources
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_L152RE/stm32l1xx_spi.h@308:59cc78a25982, 2014-09-05 (annotated)
- Committer:
- todotani
- Date:
- Fri Sep 05 14:20:33 2014 +0000
- Revision:
- 308:59cc78a25982
- Parent:
- 106:ced8cbb51063
BLE_Health_Thermometer for mbed HRM1017 with BLE library 0.1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 76:aeb1df146756 | 1 | /** |
mbed_official | 76:aeb1df146756 | 2 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 3 | * @file stm32l1xx_spi.h |
mbed_official | 76:aeb1df146756 | 4 | * @author MCD Application Team |
mbed_official | 80:66393a7b209d | 5 | * @version V1.3.0 |
mbed_official | 80:66393a7b209d | 6 | * @date 31-January-2014 |
mbed_official | 76:aeb1df146756 | 7 | * @brief This file contains all the functions prototypes for the SPI |
mbed_official | 76:aeb1df146756 | 8 | * firmware library. |
mbed_official | 76:aeb1df146756 | 9 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 10 | * @attention |
mbed_official | 76:aeb1df146756 | 11 | * |
mbed_official | 106:ced8cbb51063 | 12 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 76:aeb1df146756 | 13 | * |
mbed_official | 106:ced8cbb51063 | 14 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 106:ced8cbb51063 | 15 | * are permitted provided that the following conditions are met: |
mbed_official | 106:ced8cbb51063 | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 106:ced8cbb51063 | 17 | * this list of conditions and the following disclaimer. |
mbed_official | 106:ced8cbb51063 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 106:ced8cbb51063 | 19 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 106:ced8cbb51063 | 20 | * and/or other materials provided with the distribution. |
mbed_official | 106:ced8cbb51063 | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 106:ced8cbb51063 | 22 | * may be used to endorse or promote products derived from this software |
mbed_official | 106:ced8cbb51063 | 23 | * without specific prior written permission. |
mbed_official | 76:aeb1df146756 | 24 | * |
mbed_official | 106:ced8cbb51063 | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 106:ced8cbb51063 | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 106:ced8cbb51063 | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 106:ced8cbb51063 | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 106:ced8cbb51063 | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 106:ced8cbb51063 | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 106:ced8cbb51063 | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 106:ced8cbb51063 | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 106:ced8cbb51063 | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 106:ced8cbb51063 | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 76:aeb1df146756 | 35 | * |
mbed_official | 76:aeb1df146756 | 36 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 37 | */ |
mbed_official | 76:aeb1df146756 | 38 | |
mbed_official | 76:aeb1df146756 | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 40 | #ifndef __STM32L1xx_SPI_H |
mbed_official | 76:aeb1df146756 | 41 | #define __STM32L1xx_SPI_H |
mbed_official | 76:aeb1df146756 | 42 | |
mbed_official | 76:aeb1df146756 | 43 | #ifdef __cplusplus |
mbed_official | 76:aeb1df146756 | 44 | extern "C" { |
mbed_official | 76:aeb1df146756 | 45 | #endif |
mbed_official | 76:aeb1df146756 | 46 | |
mbed_official | 76:aeb1df146756 | 47 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 48 | #include "stm32l1xx.h" |
mbed_official | 76:aeb1df146756 | 49 | |
mbed_official | 76:aeb1df146756 | 50 | /** @addtogroup STM32L1xx_StdPeriph_Driver |
mbed_official | 76:aeb1df146756 | 51 | * @{ |
mbed_official | 76:aeb1df146756 | 52 | */ |
mbed_official | 76:aeb1df146756 | 53 | |
mbed_official | 76:aeb1df146756 | 54 | /** @addtogroup SPI |
mbed_official | 76:aeb1df146756 | 55 | * @{ |
mbed_official | 76:aeb1df146756 | 56 | */ |
mbed_official | 76:aeb1df146756 | 57 | |
mbed_official | 76:aeb1df146756 | 58 | /* Exported types ------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 59 | |
mbed_official | 76:aeb1df146756 | 60 | /** |
mbed_official | 76:aeb1df146756 | 61 | * @brief SPI Init structure definition |
mbed_official | 76:aeb1df146756 | 62 | */ |
mbed_official | 76:aeb1df146756 | 63 | |
mbed_official | 76:aeb1df146756 | 64 | typedef struct |
mbed_official | 76:aeb1df146756 | 65 | { |
mbed_official | 76:aeb1df146756 | 66 | uint16_t SPI_Direction; /*!< Specifies the SPI unidirectional or bidirectional data mode. |
mbed_official | 76:aeb1df146756 | 67 | This parameter can be a value of @ref SPI_data_direction */ |
mbed_official | 76:aeb1df146756 | 68 | |
mbed_official | 76:aeb1df146756 | 69 | uint16_t SPI_Mode; /*!< Specifies the SPI operating mode. |
mbed_official | 76:aeb1df146756 | 70 | This parameter can be a value of @ref SPI_mode */ |
mbed_official | 76:aeb1df146756 | 71 | |
mbed_official | 76:aeb1df146756 | 72 | uint16_t SPI_DataSize; /*!< Specifies the SPI data size. |
mbed_official | 76:aeb1df146756 | 73 | This parameter can be a value of @ref SPI_data_size */ |
mbed_official | 76:aeb1df146756 | 74 | |
mbed_official | 76:aeb1df146756 | 75 | uint16_t SPI_CPOL; /*!< Specifies the serial clock steady state. |
mbed_official | 76:aeb1df146756 | 76 | This parameter can be a value of @ref SPI_Clock_Polarity */ |
mbed_official | 76:aeb1df146756 | 77 | |
mbed_official | 76:aeb1df146756 | 78 | uint16_t SPI_CPHA; /*!< Specifies the clock active edge for the bit capture. |
mbed_official | 76:aeb1df146756 | 79 | This parameter can be a value of @ref SPI_Clock_Phase */ |
mbed_official | 76:aeb1df146756 | 80 | |
mbed_official | 76:aeb1df146756 | 81 | uint16_t SPI_NSS; /*!< Specifies whether the NSS signal is managed by |
mbed_official | 76:aeb1df146756 | 82 | hardware (NSS pin) or by software using the SSI bit. |
mbed_official | 76:aeb1df146756 | 83 | This parameter can be a value of @ref SPI_Slave_Select_management */ |
mbed_official | 76:aeb1df146756 | 84 | |
mbed_official | 76:aeb1df146756 | 85 | uint16_t SPI_BaudRatePrescaler; /*!< Specifies the Baud Rate prescaler value which will be |
mbed_official | 76:aeb1df146756 | 86 | used to configure the transmit and receive SCK clock. |
mbed_official | 76:aeb1df146756 | 87 | This parameter can be a value of @ref SPI_BaudRate_Prescaler |
mbed_official | 76:aeb1df146756 | 88 | @note The communication clock is derived from the master |
mbed_official | 76:aeb1df146756 | 89 | clock. The slave clock does not need to be set. */ |
mbed_official | 76:aeb1df146756 | 90 | |
mbed_official | 76:aeb1df146756 | 91 | uint16_t SPI_FirstBit; /*!< Specifies whether data transfers start from MSB or LSB bit. |
mbed_official | 76:aeb1df146756 | 92 | This parameter can be a value of @ref SPI_MSB_LSB_transmission */ |
mbed_official | 76:aeb1df146756 | 93 | |
mbed_official | 76:aeb1df146756 | 94 | uint16_t SPI_CRCPolynomial; /*!< Specifies the polynomial used for the CRC calculation. */ |
mbed_official | 76:aeb1df146756 | 95 | }SPI_InitTypeDef; |
mbed_official | 76:aeb1df146756 | 96 | |
mbed_official | 76:aeb1df146756 | 97 | /** |
mbed_official | 76:aeb1df146756 | 98 | * @brief I2S Init structure definition |
mbed_official | 76:aeb1df146756 | 99 | */ |
mbed_official | 76:aeb1df146756 | 100 | |
mbed_official | 76:aeb1df146756 | 101 | typedef struct |
mbed_official | 76:aeb1df146756 | 102 | { |
mbed_official | 76:aeb1df146756 | 103 | |
mbed_official | 76:aeb1df146756 | 104 | uint16_t I2S_Mode; /*!< Specifies the I2S operating mode. |
mbed_official | 76:aeb1df146756 | 105 | This parameter can be a value of @ref SPI_I2S_Mode */ |
mbed_official | 76:aeb1df146756 | 106 | |
mbed_official | 76:aeb1df146756 | 107 | uint16_t I2S_Standard; /*!< Specifies the standard used for the I2S communication. |
mbed_official | 76:aeb1df146756 | 108 | This parameter can be a value of @ref SPI_I2S_Standard */ |
mbed_official | 76:aeb1df146756 | 109 | |
mbed_official | 76:aeb1df146756 | 110 | uint16_t I2S_DataFormat; /*!< Specifies the data format for the I2S communication. |
mbed_official | 76:aeb1df146756 | 111 | This parameter can be a value of @ref SPI_I2S_Data_Format */ |
mbed_official | 76:aeb1df146756 | 112 | |
mbed_official | 76:aeb1df146756 | 113 | uint16_t I2S_MCLKOutput; /*!< Specifies whether the I2S MCLK output is enabled or not. |
mbed_official | 76:aeb1df146756 | 114 | This parameter can be a value of @ref SPI_I2S_MCLK_Output */ |
mbed_official | 76:aeb1df146756 | 115 | |
mbed_official | 76:aeb1df146756 | 116 | uint32_t I2S_AudioFreq; /*!< Specifies the frequency selected for the I2S communication. |
mbed_official | 76:aeb1df146756 | 117 | This parameter can be a value of @ref SPI_I2S_Audio_Frequency */ |
mbed_official | 76:aeb1df146756 | 118 | |
mbed_official | 76:aeb1df146756 | 119 | uint16_t I2S_CPOL; /*!< Specifies the idle state of the I2S clock. |
mbed_official | 76:aeb1df146756 | 120 | This parameter can be a value of @ref SPI_I2S_Clock_Polarity */ |
mbed_official | 76:aeb1df146756 | 121 | }I2S_InitTypeDef; |
mbed_official | 76:aeb1df146756 | 122 | |
mbed_official | 76:aeb1df146756 | 123 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 124 | |
mbed_official | 76:aeb1df146756 | 125 | /** @defgroup SPI_Exported_Constants |
mbed_official | 76:aeb1df146756 | 126 | * @{ |
mbed_official | 76:aeb1df146756 | 127 | */ |
mbed_official | 76:aeb1df146756 | 128 | |
mbed_official | 76:aeb1df146756 | 129 | #define IS_SPI_ALL_PERIPH(PERIPH) (((PERIPH) == SPI1) || \ |
mbed_official | 76:aeb1df146756 | 130 | ((PERIPH) == SPI2) || \ |
mbed_official | 76:aeb1df146756 | 131 | ((PERIPH) == SPI3)) |
mbed_official | 76:aeb1df146756 | 132 | #define IS_SPI_23_PERIPH(PERIPH) (((PERIPH) == SPI2) || \ |
mbed_official | 76:aeb1df146756 | 133 | ((PERIPH) == SPI3)) |
mbed_official | 76:aeb1df146756 | 134 | |
mbed_official | 76:aeb1df146756 | 135 | /** @defgroup SPI_data_direction |
mbed_official | 76:aeb1df146756 | 136 | * @{ |
mbed_official | 76:aeb1df146756 | 137 | */ |
mbed_official | 76:aeb1df146756 | 138 | |
mbed_official | 76:aeb1df146756 | 139 | #define SPI_Direction_2Lines_FullDuplex ((uint16_t)0x0000) |
mbed_official | 76:aeb1df146756 | 140 | #define SPI_Direction_2Lines_RxOnly ((uint16_t)0x0400) |
mbed_official | 76:aeb1df146756 | 141 | #define SPI_Direction_1Line_Rx ((uint16_t)0x8000) |
mbed_official | 76:aeb1df146756 | 142 | #define SPI_Direction_1Line_Tx ((uint16_t)0xC000) |
mbed_official | 76:aeb1df146756 | 143 | #define IS_SPI_DIRECTION_MODE(MODE) (((MODE) == SPI_Direction_2Lines_FullDuplex) || \ |
mbed_official | 76:aeb1df146756 | 144 | ((MODE) == SPI_Direction_2Lines_RxOnly) || \ |
mbed_official | 76:aeb1df146756 | 145 | ((MODE) == SPI_Direction_1Line_Rx) || \ |
mbed_official | 76:aeb1df146756 | 146 | ((MODE) == SPI_Direction_1Line_Tx)) |
mbed_official | 76:aeb1df146756 | 147 | /** |
mbed_official | 76:aeb1df146756 | 148 | * @} |
mbed_official | 76:aeb1df146756 | 149 | */ |
mbed_official | 76:aeb1df146756 | 150 | |
mbed_official | 76:aeb1df146756 | 151 | /** @defgroup SPI_mode |
mbed_official | 76:aeb1df146756 | 152 | * @{ |
mbed_official | 76:aeb1df146756 | 153 | */ |
mbed_official | 76:aeb1df146756 | 154 | |
mbed_official | 76:aeb1df146756 | 155 | #define SPI_Mode_Master ((uint16_t)0x0104) |
mbed_official | 76:aeb1df146756 | 156 | #define SPI_Mode_Slave ((uint16_t)0x0000) |
mbed_official | 76:aeb1df146756 | 157 | #define IS_SPI_MODE(MODE) (((MODE) == SPI_Mode_Master) || \ |
mbed_official | 76:aeb1df146756 | 158 | ((MODE) == SPI_Mode_Slave)) |
mbed_official | 76:aeb1df146756 | 159 | /** |
mbed_official | 76:aeb1df146756 | 160 | * @} |
mbed_official | 76:aeb1df146756 | 161 | */ |
mbed_official | 76:aeb1df146756 | 162 | |
mbed_official | 76:aeb1df146756 | 163 | /** @defgroup SPI_data_size |
mbed_official | 76:aeb1df146756 | 164 | * @{ |
mbed_official | 76:aeb1df146756 | 165 | */ |
mbed_official | 76:aeb1df146756 | 166 | |
mbed_official | 76:aeb1df146756 | 167 | #define SPI_DataSize_16b ((uint16_t)0x0800) |
mbed_official | 76:aeb1df146756 | 168 | #define SPI_DataSize_8b ((uint16_t)0x0000) |
mbed_official | 76:aeb1df146756 | 169 | #define IS_SPI_DATASIZE(DATASIZE) (((DATASIZE) == SPI_DataSize_16b) || \ |
mbed_official | 76:aeb1df146756 | 170 | ((DATASIZE) == SPI_DataSize_8b)) |
mbed_official | 76:aeb1df146756 | 171 | /** |
mbed_official | 76:aeb1df146756 | 172 | * @} |
mbed_official | 76:aeb1df146756 | 173 | */ |
mbed_official | 76:aeb1df146756 | 174 | |
mbed_official | 76:aeb1df146756 | 175 | /** @defgroup SPI_Clock_Polarity |
mbed_official | 76:aeb1df146756 | 176 | * @{ |
mbed_official | 76:aeb1df146756 | 177 | */ |
mbed_official | 76:aeb1df146756 | 178 | |
mbed_official | 76:aeb1df146756 | 179 | #define SPI_CPOL_Low ((uint16_t)0x0000) |
mbed_official | 76:aeb1df146756 | 180 | #define SPI_CPOL_High ((uint16_t)0x0002) |
mbed_official | 76:aeb1df146756 | 181 | #define IS_SPI_CPOL(CPOL) (((CPOL) == SPI_CPOL_Low) || \ |
mbed_official | 76:aeb1df146756 | 182 | ((CPOL) == SPI_CPOL_High)) |
mbed_official | 76:aeb1df146756 | 183 | /** |
mbed_official | 76:aeb1df146756 | 184 | * @} |
mbed_official | 76:aeb1df146756 | 185 | */ |
mbed_official | 76:aeb1df146756 | 186 | |
mbed_official | 76:aeb1df146756 | 187 | /** @defgroup SPI_Clock_Phase |
mbed_official | 76:aeb1df146756 | 188 | * @{ |
mbed_official | 76:aeb1df146756 | 189 | */ |
mbed_official | 76:aeb1df146756 | 190 | |
mbed_official | 76:aeb1df146756 | 191 | #define SPI_CPHA_1Edge ((uint16_t)0x0000) |
mbed_official | 76:aeb1df146756 | 192 | #define SPI_CPHA_2Edge ((uint16_t)0x0001) |
mbed_official | 76:aeb1df146756 | 193 | #define IS_SPI_CPHA(CPHA) (((CPHA) == SPI_CPHA_1Edge) || \ |
mbed_official | 76:aeb1df146756 | 194 | ((CPHA) == SPI_CPHA_2Edge)) |
mbed_official | 76:aeb1df146756 | 195 | /** |
mbed_official | 76:aeb1df146756 | 196 | * @} |
mbed_official | 76:aeb1df146756 | 197 | */ |
mbed_official | 76:aeb1df146756 | 198 | |
mbed_official | 76:aeb1df146756 | 199 | /** @defgroup SPI_Slave_Select_management |
mbed_official | 76:aeb1df146756 | 200 | * @{ |
mbed_official | 76:aeb1df146756 | 201 | */ |
mbed_official | 76:aeb1df146756 | 202 | |
mbed_official | 76:aeb1df146756 | 203 | #define SPI_NSS_Soft ((uint16_t)0x0200) |
mbed_official | 76:aeb1df146756 | 204 | #define SPI_NSS_Hard ((uint16_t)0x0000) |
mbed_official | 76:aeb1df146756 | 205 | #define IS_SPI_NSS(NSS) (((NSS) == SPI_NSS_Soft) || \ |
mbed_official | 76:aeb1df146756 | 206 | ((NSS) == SPI_NSS_Hard)) |
mbed_official | 76:aeb1df146756 | 207 | /** |
mbed_official | 76:aeb1df146756 | 208 | * @} |
mbed_official | 76:aeb1df146756 | 209 | */ |
mbed_official | 76:aeb1df146756 | 210 | |
mbed_official | 76:aeb1df146756 | 211 | /** @defgroup SPI_BaudRate_Prescaler |
mbed_official | 76:aeb1df146756 | 212 | * @{ |
mbed_official | 76:aeb1df146756 | 213 | */ |
mbed_official | 76:aeb1df146756 | 214 | |
mbed_official | 76:aeb1df146756 | 215 | #define SPI_BaudRatePrescaler_2 ((uint16_t)0x0000) |
mbed_official | 76:aeb1df146756 | 216 | #define SPI_BaudRatePrescaler_4 ((uint16_t)0x0008) |
mbed_official | 76:aeb1df146756 | 217 | #define SPI_BaudRatePrescaler_8 ((uint16_t)0x0010) |
mbed_official | 76:aeb1df146756 | 218 | #define SPI_BaudRatePrescaler_16 ((uint16_t)0x0018) |
mbed_official | 76:aeb1df146756 | 219 | #define SPI_BaudRatePrescaler_32 ((uint16_t)0x0020) |
mbed_official | 76:aeb1df146756 | 220 | #define SPI_BaudRatePrescaler_64 ((uint16_t)0x0028) |
mbed_official | 76:aeb1df146756 | 221 | #define SPI_BaudRatePrescaler_128 ((uint16_t)0x0030) |
mbed_official | 76:aeb1df146756 | 222 | #define SPI_BaudRatePrescaler_256 ((uint16_t)0x0038) |
mbed_official | 76:aeb1df146756 | 223 | #define IS_SPI_BAUDRATE_PRESCALER(PRESCALER) (((PRESCALER) == SPI_BaudRatePrescaler_2) || \ |
mbed_official | 76:aeb1df146756 | 224 | ((PRESCALER) == SPI_BaudRatePrescaler_4) || \ |
mbed_official | 76:aeb1df146756 | 225 | ((PRESCALER) == SPI_BaudRatePrescaler_8) || \ |
mbed_official | 76:aeb1df146756 | 226 | ((PRESCALER) == SPI_BaudRatePrescaler_16) || \ |
mbed_official | 76:aeb1df146756 | 227 | ((PRESCALER) == SPI_BaudRatePrescaler_32) || \ |
mbed_official | 76:aeb1df146756 | 228 | ((PRESCALER) == SPI_BaudRatePrescaler_64) || \ |
mbed_official | 76:aeb1df146756 | 229 | ((PRESCALER) == SPI_BaudRatePrescaler_128) || \ |
mbed_official | 76:aeb1df146756 | 230 | ((PRESCALER) == SPI_BaudRatePrescaler_256)) |
mbed_official | 76:aeb1df146756 | 231 | /** |
mbed_official | 76:aeb1df146756 | 232 | * @} |
mbed_official | 76:aeb1df146756 | 233 | */ |
mbed_official | 76:aeb1df146756 | 234 | |
mbed_official | 76:aeb1df146756 | 235 | /** @defgroup SPI_MSB_LSB_transmission |
mbed_official | 76:aeb1df146756 | 236 | * @{ |
mbed_official | 76:aeb1df146756 | 237 | */ |
mbed_official | 76:aeb1df146756 | 238 | |
mbed_official | 76:aeb1df146756 | 239 | #define SPI_FirstBit_MSB ((uint16_t)0x0000) |
mbed_official | 76:aeb1df146756 | 240 | #define SPI_FirstBit_LSB ((uint16_t)0x0080) |
mbed_official | 76:aeb1df146756 | 241 | #define IS_SPI_FIRST_BIT(BIT) (((BIT) == SPI_FirstBit_MSB) || \ |
mbed_official | 76:aeb1df146756 | 242 | ((BIT) == SPI_FirstBit_LSB)) |
mbed_official | 76:aeb1df146756 | 243 | /** |
mbed_official | 76:aeb1df146756 | 244 | * @} |
mbed_official | 76:aeb1df146756 | 245 | */ |
mbed_official | 76:aeb1df146756 | 246 | |
mbed_official | 76:aeb1df146756 | 247 | /** @defgroup SPI_I2S_Mode |
mbed_official | 76:aeb1df146756 | 248 | * @{ |
mbed_official | 76:aeb1df146756 | 249 | */ |
mbed_official | 76:aeb1df146756 | 250 | |
mbed_official | 76:aeb1df146756 | 251 | #define I2S_Mode_SlaveTx ((uint16_t)0x0000) |
mbed_official | 76:aeb1df146756 | 252 | #define I2S_Mode_SlaveRx ((uint16_t)0x0100) |
mbed_official | 76:aeb1df146756 | 253 | #define I2S_Mode_MasterTx ((uint16_t)0x0200) |
mbed_official | 76:aeb1df146756 | 254 | #define I2S_Mode_MasterRx ((uint16_t)0x0300) |
mbed_official | 76:aeb1df146756 | 255 | #define IS_I2S_MODE(MODE) (((MODE) == I2S_Mode_SlaveTx) || \ |
mbed_official | 76:aeb1df146756 | 256 | ((MODE) == I2S_Mode_SlaveRx) || \ |
mbed_official | 76:aeb1df146756 | 257 | ((MODE) == I2S_Mode_MasterTx)|| \ |
mbed_official | 76:aeb1df146756 | 258 | ((MODE) == I2S_Mode_MasterRx)) |
mbed_official | 76:aeb1df146756 | 259 | /** |
mbed_official | 76:aeb1df146756 | 260 | * @} |
mbed_official | 76:aeb1df146756 | 261 | */ |
mbed_official | 76:aeb1df146756 | 262 | |
mbed_official | 76:aeb1df146756 | 263 | |
mbed_official | 76:aeb1df146756 | 264 | /** @defgroup SPI_I2S_Standard |
mbed_official | 76:aeb1df146756 | 265 | * @{ |
mbed_official | 76:aeb1df146756 | 266 | */ |
mbed_official | 76:aeb1df146756 | 267 | |
mbed_official | 76:aeb1df146756 | 268 | #define I2S_Standard_Phillips ((uint16_t)0x0000) |
mbed_official | 76:aeb1df146756 | 269 | #define I2S_Standard_MSB ((uint16_t)0x0010) |
mbed_official | 76:aeb1df146756 | 270 | #define I2S_Standard_LSB ((uint16_t)0x0020) |
mbed_official | 76:aeb1df146756 | 271 | #define I2S_Standard_PCMShort ((uint16_t)0x0030) |
mbed_official | 76:aeb1df146756 | 272 | #define I2S_Standard_PCMLong ((uint16_t)0x00B0) |
mbed_official | 76:aeb1df146756 | 273 | #define IS_I2S_STANDARD(STANDARD) (((STANDARD) == I2S_Standard_Phillips) || \ |
mbed_official | 76:aeb1df146756 | 274 | ((STANDARD) == I2S_Standard_MSB) || \ |
mbed_official | 76:aeb1df146756 | 275 | ((STANDARD) == I2S_Standard_LSB) || \ |
mbed_official | 76:aeb1df146756 | 276 | ((STANDARD) == I2S_Standard_PCMShort) || \ |
mbed_official | 76:aeb1df146756 | 277 | ((STANDARD) == I2S_Standard_PCMLong)) |
mbed_official | 76:aeb1df146756 | 278 | /** |
mbed_official | 76:aeb1df146756 | 279 | * @} |
mbed_official | 76:aeb1df146756 | 280 | */ |
mbed_official | 76:aeb1df146756 | 281 | |
mbed_official | 76:aeb1df146756 | 282 | /** @defgroup SPI_I2S_Data_Format |
mbed_official | 76:aeb1df146756 | 283 | * @{ |
mbed_official | 76:aeb1df146756 | 284 | */ |
mbed_official | 76:aeb1df146756 | 285 | |
mbed_official | 76:aeb1df146756 | 286 | #define I2S_DataFormat_16b ((uint16_t)0x0000) |
mbed_official | 76:aeb1df146756 | 287 | #define I2S_DataFormat_16bextended ((uint16_t)0x0001) |
mbed_official | 76:aeb1df146756 | 288 | #define I2S_DataFormat_24b ((uint16_t)0x0003) |
mbed_official | 76:aeb1df146756 | 289 | #define I2S_DataFormat_32b ((uint16_t)0x0005) |
mbed_official | 76:aeb1df146756 | 290 | #define IS_I2S_DATA_FORMAT(FORMAT) (((FORMAT) == I2S_DataFormat_16b) || \ |
mbed_official | 76:aeb1df146756 | 291 | ((FORMAT) == I2S_DataFormat_16bextended) || \ |
mbed_official | 76:aeb1df146756 | 292 | ((FORMAT) == I2S_DataFormat_24b) || \ |
mbed_official | 76:aeb1df146756 | 293 | ((FORMAT) == I2S_DataFormat_32b)) |
mbed_official | 76:aeb1df146756 | 294 | /** |
mbed_official | 76:aeb1df146756 | 295 | * @} |
mbed_official | 76:aeb1df146756 | 296 | */ |
mbed_official | 76:aeb1df146756 | 297 | |
mbed_official | 76:aeb1df146756 | 298 | /** @defgroup SPI_I2S_MCLK_Output |
mbed_official | 76:aeb1df146756 | 299 | * @{ |
mbed_official | 76:aeb1df146756 | 300 | */ |
mbed_official | 76:aeb1df146756 | 301 | |
mbed_official | 76:aeb1df146756 | 302 | #define I2S_MCLKOutput_Enable ((uint16_t)0x0200) |
mbed_official | 76:aeb1df146756 | 303 | #define I2S_MCLKOutput_Disable ((uint16_t)0x0000) |
mbed_official | 76:aeb1df146756 | 304 | #define IS_I2S_MCLK_OUTPUT(OUTPUT) (((OUTPUT) == I2S_MCLKOutput_Enable) || \ |
mbed_official | 76:aeb1df146756 | 305 | ((OUTPUT) == I2S_MCLKOutput_Disable)) |
mbed_official | 76:aeb1df146756 | 306 | /** |
mbed_official | 76:aeb1df146756 | 307 | * @} |
mbed_official | 76:aeb1df146756 | 308 | */ |
mbed_official | 76:aeb1df146756 | 309 | |
mbed_official | 76:aeb1df146756 | 310 | /** @defgroup SPI_I2S_Audio_Frequency |
mbed_official | 76:aeb1df146756 | 311 | * @{ |
mbed_official | 76:aeb1df146756 | 312 | */ |
mbed_official | 76:aeb1df146756 | 313 | |
mbed_official | 76:aeb1df146756 | 314 | #define I2S_AudioFreq_192k ((uint32_t)192000) |
mbed_official | 76:aeb1df146756 | 315 | #define I2S_AudioFreq_96k ((uint32_t)96000) |
mbed_official | 76:aeb1df146756 | 316 | #define I2S_AudioFreq_48k ((uint32_t)48000) |
mbed_official | 76:aeb1df146756 | 317 | #define I2S_AudioFreq_44k ((uint32_t)44100) |
mbed_official | 76:aeb1df146756 | 318 | #define I2S_AudioFreq_32k ((uint32_t)32000) |
mbed_official | 76:aeb1df146756 | 319 | #define I2S_AudioFreq_22k ((uint32_t)22050) |
mbed_official | 76:aeb1df146756 | 320 | #define I2S_AudioFreq_16k ((uint32_t)16000) |
mbed_official | 76:aeb1df146756 | 321 | #define I2S_AudioFreq_11k ((uint32_t)11025) |
mbed_official | 76:aeb1df146756 | 322 | #define I2S_AudioFreq_8k ((uint32_t)8000) |
mbed_official | 76:aeb1df146756 | 323 | #define I2S_AudioFreq_Default ((uint32_t)2) |
mbed_official | 76:aeb1df146756 | 324 | |
mbed_official | 76:aeb1df146756 | 325 | #define IS_I2S_AUDIO_FREQ(FREQ) ((((FREQ) >= I2S_AudioFreq_8k) && \ |
mbed_official | 76:aeb1df146756 | 326 | ((FREQ) <= I2S_AudioFreq_192k)) || \ |
mbed_official | 76:aeb1df146756 | 327 | ((FREQ) == I2S_AudioFreq_Default)) |
mbed_official | 76:aeb1df146756 | 328 | /** |
mbed_official | 76:aeb1df146756 | 329 | * @} |
mbed_official | 76:aeb1df146756 | 330 | */ |
mbed_official | 76:aeb1df146756 | 331 | |
mbed_official | 76:aeb1df146756 | 332 | /** @defgroup SPI_I2S_Clock_Polarity |
mbed_official | 76:aeb1df146756 | 333 | * @{ |
mbed_official | 76:aeb1df146756 | 334 | */ |
mbed_official | 76:aeb1df146756 | 335 | |
mbed_official | 76:aeb1df146756 | 336 | #define I2S_CPOL_Low ((uint16_t)0x0000) |
mbed_official | 76:aeb1df146756 | 337 | #define I2S_CPOL_High ((uint16_t)0x0008) |
mbed_official | 76:aeb1df146756 | 338 | #define IS_I2S_CPOL(CPOL) (((CPOL) == I2S_CPOL_Low) || \ |
mbed_official | 76:aeb1df146756 | 339 | ((CPOL) == I2S_CPOL_High)) |
mbed_official | 76:aeb1df146756 | 340 | /** |
mbed_official | 76:aeb1df146756 | 341 | * @} |
mbed_official | 76:aeb1df146756 | 342 | */ |
mbed_official | 76:aeb1df146756 | 343 | |
mbed_official | 76:aeb1df146756 | 344 | /** @defgroup SPI_I2S_DMA_transfer_requests |
mbed_official | 76:aeb1df146756 | 345 | * @{ |
mbed_official | 76:aeb1df146756 | 346 | */ |
mbed_official | 76:aeb1df146756 | 347 | |
mbed_official | 76:aeb1df146756 | 348 | #define SPI_I2S_DMAReq_Tx ((uint16_t)0x0002) |
mbed_official | 76:aeb1df146756 | 349 | #define SPI_I2S_DMAReq_Rx ((uint16_t)0x0001) |
mbed_official | 76:aeb1df146756 | 350 | #define IS_SPI_I2S_DMAREQ(DMAREQ) ((((DMAREQ) & (uint16_t)0xFFFC) == 0x00) && ((DMAREQ) != 0x00)) |
mbed_official | 76:aeb1df146756 | 351 | /** |
mbed_official | 76:aeb1df146756 | 352 | * @} |
mbed_official | 76:aeb1df146756 | 353 | */ |
mbed_official | 76:aeb1df146756 | 354 | |
mbed_official | 76:aeb1df146756 | 355 | /** @defgroup SPI_NSS_internal_software_management |
mbed_official | 76:aeb1df146756 | 356 | * @{ |
mbed_official | 76:aeb1df146756 | 357 | */ |
mbed_official | 76:aeb1df146756 | 358 | |
mbed_official | 76:aeb1df146756 | 359 | #define SPI_NSSInternalSoft_Set ((uint16_t)0x0100) |
mbed_official | 76:aeb1df146756 | 360 | #define SPI_NSSInternalSoft_Reset ((uint16_t)0xFEFF) |
mbed_official | 76:aeb1df146756 | 361 | #define IS_SPI_NSS_INTERNAL(INTERNAL) (((INTERNAL) == SPI_NSSInternalSoft_Set) || \ |
mbed_official | 76:aeb1df146756 | 362 | ((INTERNAL) == SPI_NSSInternalSoft_Reset)) |
mbed_official | 76:aeb1df146756 | 363 | /** |
mbed_official | 76:aeb1df146756 | 364 | * @} |
mbed_official | 76:aeb1df146756 | 365 | */ |
mbed_official | 76:aeb1df146756 | 366 | |
mbed_official | 76:aeb1df146756 | 367 | /** @defgroup SPI_CRC_Transmit_Receive |
mbed_official | 76:aeb1df146756 | 368 | * @{ |
mbed_official | 76:aeb1df146756 | 369 | */ |
mbed_official | 76:aeb1df146756 | 370 | |
mbed_official | 76:aeb1df146756 | 371 | #define SPI_CRC_Tx ((uint8_t)0x00) |
mbed_official | 76:aeb1df146756 | 372 | #define SPI_CRC_Rx ((uint8_t)0x01) |
mbed_official | 76:aeb1df146756 | 373 | #define IS_SPI_CRC(CRC) (((CRC) == SPI_CRC_Tx) || ((CRC) == SPI_CRC_Rx)) |
mbed_official | 76:aeb1df146756 | 374 | /** |
mbed_official | 76:aeb1df146756 | 375 | * @} |
mbed_official | 76:aeb1df146756 | 376 | */ |
mbed_official | 76:aeb1df146756 | 377 | |
mbed_official | 76:aeb1df146756 | 378 | /** @defgroup SPI_direction_transmit_receive |
mbed_official | 76:aeb1df146756 | 379 | * @{ |
mbed_official | 76:aeb1df146756 | 380 | */ |
mbed_official | 76:aeb1df146756 | 381 | |
mbed_official | 76:aeb1df146756 | 382 | #define SPI_Direction_Rx ((uint16_t)0xBFFF) |
mbed_official | 76:aeb1df146756 | 383 | #define SPI_Direction_Tx ((uint16_t)0x4000) |
mbed_official | 76:aeb1df146756 | 384 | #define IS_SPI_DIRECTION(DIRECTION) (((DIRECTION) == SPI_Direction_Rx) || \ |
mbed_official | 76:aeb1df146756 | 385 | ((DIRECTION) == SPI_Direction_Tx)) |
mbed_official | 76:aeb1df146756 | 386 | /** |
mbed_official | 76:aeb1df146756 | 387 | * @} |
mbed_official | 76:aeb1df146756 | 388 | */ |
mbed_official | 76:aeb1df146756 | 389 | |
mbed_official | 76:aeb1df146756 | 390 | /** @defgroup SPI_I2S_interrupts_definition |
mbed_official | 76:aeb1df146756 | 391 | * @{ |
mbed_official | 76:aeb1df146756 | 392 | */ |
mbed_official | 76:aeb1df146756 | 393 | |
mbed_official | 76:aeb1df146756 | 394 | #define SPI_I2S_IT_TXE ((uint8_t)0x71) |
mbed_official | 76:aeb1df146756 | 395 | #define SPI_I2S_IT_RXNE ((uint8_t)0x60) |
mbed_official | 76:aeb1df146756 | 396 | #define SPI_I2S_IT_ERR ((uint8_t)0x50) |
mbed_official | 76:aeb1df146756 | 397 | #define I2S_IT_UDR ((uint8_t)0x53) |
mbed_official | 76:aeb1df146756 | 398 | #define SPI_I2S_IT_FRE ((uint8_t)0x58) |
mbed_official | 76:aeb1df146756 | 399 | |
mbed_official | 76:aeb1df146756 | 400 | #define IS_SPI_I2S_CONFIG_IT(IT) (((IT) == SPI_I2S_IT_TXE) || \ |
mbed_official | 76:aeb1df146756 | 401 | ((IT) == SPI_I2S_IT_RXNE) || \ |
mbed_official | 76:aeb1df146756 | 402 | ((IT) == SPI_I2S_IT_ERR)) |
mbed_official | 76:aeb1df146756 | 403 | |
mbed_official | 76:aeb1df146756 | 404 | #define SPI_I2S_IT_OVR ((uint8_t)0x56) |
mbed_official | 76:aeb1df146756 | 405 | #define SPI_IT_MODF ((uint8_t)0x55) |
mbed_official | 76:aeb1df146756 | 406 | #define SPI_IT_CRCERR ((uint8_t)0x54) |
mbed_official | 76:aeb1df146756 | 407 | |
mbed_official | 76:aeb1df146756 | 408 | #define IS_SPI_I2S_CLEAR_IT(IT) (((IT) == SPI_IT_CRCERR)) |
mbed_official | 76:aeb1df146756 | 409 | |
mbed_official | 76:aeb1df146756 | 410 | #define IS_SPI_I2S_GET_IT(IT) (((IT) == SPI_I2S_IT_RXNE) || ((IT) == SPI_I2S_IT_TXE) || \ |
mbed_official | 76:aeb1df146756 | 411 | ((IT) == SPI_IT_CRCERR) || ((IT) == SPI_IT_MODF) || \ |
mbed_official | 76:aeb1df146756 | 412 | ((IT) == SPI_I2S_IT_OVR) || ((IT) == I2S_IT_UDR) ||\ |
mbed_official | 76:aeb1df146756 | 413 | ((IT) == SPI_I2S_IT_FRE)) |
mbed_official | 76:aeb1df146756 | 414 | /** |
mbed_official | 76:aeb1df146756 | 415 | * @} |
mbed_official | 76:aeb1df146756 | 416 | */ |
mbed_official | 76:aeb1df146756 | 417 | |
mbed_official | 76:aeb1df146756 | 418 | /** @defgroup SPI_I2S_flags_definition |
mbed_official | 76:aeb1df146756 | 419 | * @{ |
mbed_official | 76:aeb1df146756 | 420 | */ |
mbed_official | 76:aeb1df146756 | 421 | |
mbed_official | 76:aeb1df146756 | 422 | #define SPI_I2S_FLAG_RXNE ((uint16_t)0x0001) |
mbed_official | 76:aeb1df146756 | 423 | #define SPI_I2S_FLAG_TXE ((uint16_t)0x0002) |
mbed_official | 76:aeb1df146756 | 424 | #define I2S_FLAG_CHSIDE ((uint16_t)0x0004) |
mbed_official | 76:aeb1df146756 | 425 | #define I2S_FLAG_UDR ((uint16_t)0x0008) |
mbed_official | 76:aeb1df146756 | 426 | #define SPI_FLAG_CRCERR ((uint16_t)0x0010) |
mbed_official | 76:aeb1df146756 | 427 | #define SPI_FLAG_MODF ((uint16_t)0x0020) |
mbed_official | 76:aeb1df146756 | 428 | #define SPI_I2S_FLAG_OVR ((uint16_t)0x0040) |
mbed_official | 76:aeb1df146756 | 429 | #define SPI_I2S_FLAG_BSY ((uint16_t)0x0080) |
mbed_official | 76:aeb1df146756 | 430 | #define SPI_I2S_FLAG_FRE ((uint16_t)0x0100) |
mbed_official | 76:aeb1df146756 | 431 | |
mbed_official | 76:aeb1df146756 | 432 | #define IS_SPI_I2S_CLEAR_FLAG(FLAG) (((FLAG) == SPI_FLAG_CRCERR)) |
mbed_official | 76:aeb1df146756 | 433 | #define IS_SPI_I2S_GET_FLAG(FLAG) (((FLAG) == SPI_I2S_FLAG_BSY) || ((FLAG) == SPI_I2S_FLAG_OVR) || \ |
mbed_official | 76:aeb1df146756 | 434 | ((FLAG) == SPI_FLAG_MODF) || ((FLAG) == SPI_FLAG_CRCERR) || \ |
mbed_official | 76:aeb1df146756 | 435 | ((FLAG) == I2S_FLAG_UDR) || ((FLAG) == I2S_FLAG_CHSIDE) || \ |
mbed_official | 76:aeb1df146756 | 436 | ((FLAG) == SPI_I2S_FLAG_TXE) || ((FLAG) == SPI_I2S_FLAG_RXNE)|| \ |
mbed_official | 76:aeb1df146756 | 437 | ((FLAG) == SPI_I2S_FLAG_FRE)) |
mbed_official | 76:aeb1df146756 | 438 | /** |
mbed_official | 76:aeb1df146756 | 439 | * @} |
mbed_official | 76:aeb1df146756 | 440 | */ |
mbed_official | 76:aeb1df146756 | 441 | |
mbed_official | 76:aeb1df146756 | 442 | /** @defgroup SPI_CRC_polynomial |
mbed_official | 76:aeb1df146756 | 443 | * @{ |
mbed_official | 76:aeb1df146756 | 444 | */ |
mbed_official | 76:aeb1df146756 | 445 | |
mbed_official | 76:aeb1df146756 | 446 | #define IS_SPI_CRC_POLYNOMIAL(POLYNOMIAL) ((POLYNOMIAL) >= 0x1) |
mbed_official | 76:aeb1df146756 | 447 | /** |
mbed_official | 76:aeb1df146756 | 448 | * @} |
mbed_official | 76:aeb1df146756 | 449 | */ |
mbed_official | 76:aeb1df146756 | 450 | |
mbed_official | 76:aeb1df146756 | 451 | /** @defgroup SPI_I2S_Legacy |
mbed_official | 76:aeb1df146756 | 452 | * @{ |
mbed_official | 76:aeb1df146756 | 453 | */ |
mbed_official | 76:aeb1df146756 | 454 | |
mbed_official | 76:aeb1df146756 | 455 | #define SPI_DMAReq_Tx SPI_I2S_DMAReq_Tx |
mbed_official | 76:aeb1df146756 | 456 | #define SPI_DMAReq_Rx SPI_I2S_DMAReq_Rx |
mbed_official | 76:aeb1df146756 | 457 | #define SPI_IT_TXE SPI_I2S_IT_TXE |
mbed_official | 76:aeb1df146756 | 458 | #define SPI_IT_RXNE SPI_I2S_IT_RXNE |
mbed_official | 76:aeb1df146756 | 459 | #define SPI_IT_ERR SPI_I2S_IT_ERR |
mbed_official | 76:aeb1df146756 | 460 | #define SPI_IT_OVR SPI_I2S_IT_OVR |
mbed_official | 76:aeb1df146756 | 461 | #define SPI_FLAG_RXNE SPI_I2S_FLAG_RXNE |
mbed_official | 76:aeb1df146756 | 462 | #define SPI_FLAG_TXE SPI_I2S_FLAG_TXE |
mbed_official | 76:aeb1df146756 | 463 | #define SPI_FLAG_OVR SPI_I2S_FLAG_OVR |
mbed_official | 76:aeb1df146756 | 464 | #define SPI_FLAG_BSY SPI_I2S_FLAG_BSY |
mbed_official | 76:aeb1df146756 | 465 | #define SPI_DeInit SPI_I2S_DeInit |
mbed_official | 76:aeb1df146756 | 466 | #define SPI_ITConfig SPI_I2S_ITConfig |
mbed_official | 76:aeb1df146756 | 467 | #define SPI_DMACmd SPI_I2S_DMACmd |
mbed_official | 76:aeb1df146756 | 468 | #define SPI_SendData SPI_I2S_SendData |
mbed_official | 76:aeb1df146756 | 469 | #define SPI_ReceiveData SPI_I2S_ReceiveData |
mbed_official | 76:aeb1df146756 | 470 | #define SPI_GetFlagStatus SPI_I2S_GetFlagStatus |
mbed_official | 76:aeb1df146756 | 471 | #define SPI_ClearFlag SPI_I2S_ClearFlag |
mbed_official | 76:aeb1df146756 | 472 | #define SPI_GetITStatus SPI_I2S_GetITStatus |
mbed_official | 76:aeb1df146756 | 473 | #define SPI_ClearITPendingBit SPI_I2S_ClearITPendingBit |
mbed_official | 76:aeb1df146756 | 474 | /** |
mbed_official | 76:aeb1df146756 | 475 | * @} |
mbed_official | 76:aeb1df146756 | 476 | */ |
mbed_official | 76:aeb1df146756 | 477 | |
mbed_official | 76:aeb1df146756 | 478 | /** |
mbed_official | 76:aeb1df146756 | 479 | * @} |
mbed_official | 76:aeb1df146756 | 480 | */ |
mbed_official | 76:aeb1df146756 | 481 | |
mbed_official | 76:aeb1df146756 | 482 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 483 | /* Exported functions ------------------------------------------------------- */ |
mbed_official | 76:aeb1df146756 | 484 | |
mbed_official | 76:aeb1df146756 | 485 | /* Function used to set the SPI configuration to the default reset state *****/ |
mbed_official | 76:aeb1df146756 | 486 | void SPI_I2S_DeInit(SPI_TypeDef* SPIx); |
mbed_official | 76:aeb1df146756 | 487 | |
mbed_official | 76:aeb1df146756 | 488 | /* Initialization and Configuration functions *********************************/ |
mbed_official | 76:aeb1df146756 | 489 | void SPI_Init(SPI_TypeDef* SPIx, SPI_InitTypeDef* SPI_InitStruct); |
mbed_official | 76:aeb1df146756 | 490 | void I2S_Init(SPI_TypeDef* SPIx, I2S_InitTypeDef* I2S_InitStruct); |
mbed_official | 76:aeb1df146756 | 491 | void SPI_StructInit(SPI_InitTypeDef* SPI_InitStruct); |
mbed_official | 76:aeb1df146756 | 492 | void I2S_StructInit(I2S_InitTypeDef* I2S_InitStruct); |
mbed_official | 76:aeb1df146756 | 493 | void SPI_Cmd(SPI_TypeDef* SPIx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 494 | void I2S_Cmd(SPI_TypeDef* SPIx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 495 | void SPI_DataSizeConfig(SPI_TypeDef* SPIx, uint16_t SPI_DataSize); |
mbed_official | 76:aeb1df146756 | 496 | void SPI_BiDirectionalLineConfig(SPI_TypeDef* SPIx, uint16_t SPI_Direction); |
mbed_official | 76:aeb1df146756 | 497 | void SPI_NSSInternalSoftwareConfig(SPI_TypeDef* SPIx, uint16_t SPI_NSSInternalSoft); |
mbed_official | 76:aeb1df146756 | 498 | void SPI_SSOutputCmd(SPI_TypeDef* SPIx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 499 | |
mbed_official | 76:aeb1df146756 | 500 | /* Data transfers functions ***************************************************/ |
mbed_official | 76:aeb1df146756 | 501 | void SPI_I2S_SendData(SPI_TypeDef* SPIx, uint16_t Data); |
mbed_official | 76:aeb1df146756 | 502 | uint16_t SPI_I2S_ReceiveData(SPI_TypeDef* SPIx); |
mbed_official | 76:aeb1df146756 | 503 | |
mbed_official | 76:aeb1df146756 | 504 | /* Hardware CRC Calculation functions *****************************************/ |
mbed_official | 76:aeb1df146756 | 505 | void SPI_CalculateCRC(SPI_TypeDef* SPIx, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 506 | void SPI_TransmitCRC(SPI_TypeDef* SPIx); |
mbed_official | 76:aeb1df146756 | 507 | uint16_t SPI_GetCRC(SPI_TypeDef* SPIx, uint8_t SPI_CRC); |
mbed_official | 76:aeb1df146756 | 508 | uint16_t SPI_GetCRCPolynomial(SPI_TypeDef* SPIx); |
mbed_official | 76:aeb1df146756 | 509 | |
mbed_official | 76:aeb1df146756 | 510 | /* DMA transfers management functions *****************************************/ |
mbed_official | 76:aeb1df146756 | 511 | void SPI_I2S_DMACmd(SPI_TypeDef* SPIx, uint16_t SPI_I2S_DMAReq, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 512 | |
mbed_official | 76:aeb1df146756 | 513 | /* Interrupts and flags management functions **********************************/ |
mbed_official | 76:aeb1df146756 | 514 | void SPI_I2S_ITConfig(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 515 | FlagStatus SPI_I2S_GetFlagStatus(SPI_TypeDef* SPIx, uint16_t SPI_I2S_FLAG); |
mbed_official | 76:aeb1df146756 | 516 | void SPI_I2S_ClearFlag(SPI_TypeDef* SPIx, uint16_t SPI_I2S_FLAG); |
mbed_official | 76:aeb1df146756 | 517 | ITStatus SPI_I2S_GetITStatus(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT); |
mbed_official | 76:aeb1df146756 | 518 | void SPI_I2S_ClearITPendingBit(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT); |
mbed_official | 76:aeb1df146756 | 519 | |
mbed_official | 76:aeb1df146756 | 520 | #ifdef __cplusplus |
mbed_official | 76:aeb1df146756 | 521 | } |
mbed_official | 76:aeb1df146756 | 522 | #endif |
mbed_official | 76:aeb1df146756 | 523 | |
mbed_official | 76:aeb1df146756 | 524 | #endif /*__STM32L1xx_SPI_H */ |
mbed_official | 76:aeb1df146756 | 525 | |
mbed_official | 76:aeb1df146756 | 526 | /** |
mbed_official | 76:aeb1df146756 | 527 | * @} |
mbed_official | 76:aeb1df146756 | 528 | */ |
mbed_official | 76:aeb1df146756 | 529 | |
mbed_official | 76:aeb1df146756 | 530 | /** |
mbed_official | 76:aeb1df146756 | 531 | * @} |
mbed_official | 76:aeb1df146756 | 532 | */ |
mbed_official | 76:aeb1df146756 | 533 | |
mbed_official | 76:aeb1df146756 | 534 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |