STM32F0xx Standard Peripherals Firmware Library
|
I2C_WakeUpFromStop/stm32f0xx_i2c_cpal_usercallback.c
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file I2C/I2C_WakeUpFromStop/stm32f0xx_i2c_cpal_usercallback.c 00004 * @author MCD Application Team 00005 * @version V1.4.0 00006 * @date 24-July-2014 00007 * @brief This file provides all the CPAL UserCallback functions. 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2> 00012 * 00013 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 00014 * You may not use this file except in compliance with the License. 00015 * You may obtain a copy of the License at: 00016 * 00017 * http://www.st.com/software_license_agreement_liberty_v2 00018 * 00019 * Unless required by applicable law or agreed to in writing, software 00020 * distributed under the License is distributed on an "AS IS" BASIS, 00021 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00022 * See the License for the specific language governing permissions and 00023 * limitations under the License. 00024 * 00025 ****************************************************************************** 00026 */ 00027 00028 /* Includes ------------------------------------------------------------------*/ 00029 #include "stm32f0xx_i2c_cpal.h" 00030 #include "main.h" 00031 00032 /* Private typedef -----------------------------------------------------------*/ 00033 /* Private defines -----------------------------------------------------------*/ 00034 /* Private variables ---------------------------------------------------------*/ 00035 extern __IO TestStatus TransferStatus; 00036 00037 /* Private macro -------------------------------------------------------------*/ 00038 /* Private function prototypes -----------------------------------------------*/ 00039 /* Private functions ---------------------------------------------------------*/ 00040 00041 00042 00043 /*------------------------------------------------------------------------------ 00044 CPAL User Callbacks implementations 00045 ------------------------------------------------------------------------------*/ 00046 00047 00048 /*=========== Timeout UserCallback ===========*/ 00049 00050 00051 /** 00052 * @brief User callback that manages the Timeout error 00053 * @param pDevInitStruct 00054 * @retval None. 00055 */ 00056 uint32_t CPAL_TIMEOUT_UserCallback(CPAL_InitTypeDef* pDevInitStruct) 00057 { 00058 /* Update LCD Display */ 00059 LCD_SetBackColor(Red); 00060 LCD_SetTextColor(White); 00061 LCD_DisplayStringLine(Line8, MESSAGE12); 00062 00063 /* Update CPAL_State, wCPAL_DevError and wCPAL_Timeout */ 00064 pDevInitStruct->CPAL_State = CPAL_STATE_READY; 00065 pDevInitStruct->wCPAL_DevError = CPAL_I2C_ERR_NONE ; 00066 pDevInitStruct->wCPAL_Timeout = CPAL_I2C_TIMEOUT_DEFAULT; 00067 00068 /* DeInitialize CPAL device */ 00069 CPAL_I2C_DeInit(pDevInitStruct); 00070 00071 /* Initialize CPAL device with the selected parameters */ 00072 CPAL_I2C_Init(pDevInitStruct); 00073 00074 return CPAL_PASS; 00075 } 00076 00077 00078 /*=========== Transfer UserCallback ===========*/ 00079 00080 00081 /** 00082 * @brief Manages the End of Tx transfer event 00083 * @param pDevInitStruct 00084 * @retval None 00085 */ 00086 /*void CPAL_I2C_TXTC_UserCallback(CPAL_InitTypeDef* pDevInitStruct) 00087 { 00088 00089 }*/ 00090 00091 00092 /** 00093 * @brief Manages the End of Rx transfer event 00094 * @param pDevInitStruct 00095 * @retval None 00096 */ 00097 /*void CPAL_I2C_RXTC_UserCallback(CPAL_InitTypeDef* pDevInitStruct) 00098 { 00099 00100 }*/ 00101 00102 00103 /** 00104 * @brief Manages Tx transfer event 00105 * @param pDevInitStruct 00106 * @retval None 00107 */ 00108 /*void CPAL_I2C_TX_UserCallback(CPAL_InitTypeDef* pDevInitStruct) 00109 { 00110 00111 }*/ 00112 00113 00114 /** 00115 * @brief Manages Rx transfer event 00116 * @param pDevInitStruct 00117 * @retval None 00118 */ 00119 /*void CPAL_I2C_RX_UserCallback(CPAL_InitTypeDef* pDevInitStruct) 00120 { 00121 00122 }*/ 00123 00124 00125 /** 00126 * @brief Manages the End of DMA Tx transfer event 00127 * @param pDevInitStruct 00128 * @retval None 00129 */ 00130 /*void CPAL_I2C_DMATXTC_UserCallback(CPAL_InitTypeDef* pDevInitStruct) 00131 { 00132 00133 }*/ 00134 00135 00136 /** 00137 * @brief Manages the Half of DMA Tx transfer event 00138 * @param pDevInitStruct 00139 * @retval None 00140 */ 00141 /*void CPAL_I2C_DMATXHT_UserCallback(CPAL_InitTypeDef* pDevInitStruct) 00142 { 00143 00144 }*/ 00145 00146 00147 /** 00148 * @brief Manages Error of DMA Tx transfer event 00149 * @param pDevInitStruct 00150 * @retval None 00151 */ 00152 /*void CPAL_I2C_DMATXTE_UserCallback(CPAL_InitTypeDef* pDevInitStruct) 00153 { 00154 00155 }*/ 00156 00157 00158 /** 00159 * @brief Manages the End of DMA Rx transfer event 00160 * @param pDevInitStruct 00161 * @retval None 00162 */ 00163 /*void CPAL_I2C_DMARXTC_UserCallback(CPAL_InitTypeDef* pDevInitStruct) 00164 { 00165 00166 }*/ 00167 00168 00169 /** 00170 * @brief Manages the Half of DMA Rx transfer event 00171 * @param pDevInitStruct 00172 * @retval None 00173 */ 00174 /*void CPAL_I2C_DMARXHT_UserCallback(CPAL_InitTypeDef* pDevInitStruct) 00175 { 00176 00177 }*/ 00178 00179 00180 /** 00181 * @brief Manages Error of DMA Rx transfer event 00182 * @param pDevInitStruct 00183 * @retval None 00184 */ 00185 /*void CPAL_I2C_DMARXTE_UserCallback(CPAL_InitTypeDef* pDevInitStruct) 00186 { 00187 00188 }*/ 00189 00190 00191 /*=========== Error UserCallback ===========*/ 00192 00193 00194 /** 00195 * @brief User callback that manages the I2C device errors 00196 * @note Make sure that the define USE_SINGLE_ERROR_CALLBACK is uncommented in 00197 * the cpal_conf.h file, otherwise this callback will not be functional 00198 * @param pDevInitStruct 00199 * @param DeviceError 00200 * @retval None 00201 */ 00202 void CPAL_I2C_ERR_UserCallback(CPAL_DevTypeDef pDevInstance, uint32_t DeviceError) 00203 { 00204 /* Update CPAL_State */ 00205 I2C_DevStructures[pDevInstance]->CPAL_State = CPAL_STATE_READY; 00206 00207 /* Update Display settings */ 00208 LCD_SetBackColor(Red); 00209 LCD_SetTextColor(White); 00210 00211 /* if an error occurred except AF*/ 00212 if (DeviceError != CPAL_I2C_ERR_AF ) 00213 { 00214 /* Deinitialize device */ 00215 CPAL_I2C_DeInit(I2C_DevStructures[pDevInstance]); 00216 00217 /* Initialize device with the selected parameters */ 00218 CPAL_I2C_Init(I2C_DevStructures[pDevInstance]); 00219 00220 /* Update LCD Display */ 00221 LCD_DisplayStringLine(Line8, MESSAGE11); 00222 } 00223 else 00224 { 00225 /* Update LCD Display */ 00226 LCD_DisplayStringLine(Line8, MESSAGE10); 00227 } 00228 00229 /* Update wCPAL_DevError */ 00230 I2C_DevStructures[pDevInstance]->wCPAL_DevError = CPAL_I2C_ERR_NONE ; 00231 00232 TransferStatus = FAILED; 00233 } 00234 00235 00236 /** 00237 * @brief User callback that manages BERR I2C device errors 00238 * @note Make sure that the define USE_MULTIPLE_ERROR_CALLBACK is uncommented in 00239 * the cpal_conf.h file, otherwise this callback will not be functional 00240 * @param pDevInstance 00241 * @retval None 00242 */ 00243 /*void CPAL_I2C_BERR_UserCallback(CPAL_DevTypeDef pDevInstance) 00244 { 00245 00246 }*/ 00247 00248 00249 /** 00250 * @brief User callback that manages ARLO I2C device errors 00251 * @note Make sure that the define USE_MULTIPLE_ERROR_CALLBACK is uncommented in 00252 * the cpal_conf.h file, otherwise this callback will not be functional 00253 * @param pDevInstance 00254 * @retval None 00255 */ 00256 /*void CPAL_I2C_ARLO_UserCallback(CPAL_DevTypeDef pDevInstance) 00257 { 00258 00259 }*/ 00260 00261 00262 /** 00263 * @brief User callback that manages OVR I2C device errors 00264 * @note Make sure that the define USE_MULTIPLE_ERROR_CALLBACK is uncommented in 00265 * the cpal_conf.h file, otherwise this callback will not be functional 00266 * @param pDevInstance 00267 * @retval None 00268 */ 00269 /*void CPAL_I2C_OVR_UserCallback(CPAL_DevTypeDef pDevInstance) 00270 { 00271 00272 }*/ 00273 00274 00275 /** 00276 * @brief User callback that manages AF I2C device errors. 00277 * @note Make sure that the define USE_MULTIPLE_ERROR_CALLBACK is uncommented in 00278 * the cpal_conf.h file, otherwise this callback will not be functional 00279 * @param pDevInstance 00280 * @retval None 00281 */ 00282 /*void CPAL_I2C_AF_UserCallback(CPAL_DevTypeDef pDevInstance) 00283 { 00284 00285 }*/ 00286 00287 00288 /*=========== Addressing Mode UserCallback ===========*/ 00289 00290 00291 /** 00292 * @brief User callback that manage General Call Addressing mode 00293 * @param pDevInitStruct 00294 * @retval None 00295 */ 00296 /*void CPAL_I2C_GENCALL_UserCallback(CPAL_InitTypeDef* pDevInitStruct) 00297 { 00298 00299 }*/ 00300 00301 00302 /** 00303 * @brief User callback that manage Dual Address Addressing mode 00304 * @param pDevInitStruct 00305 * @retval None 00306 */ 00307 /*void CPAL_I2C_DUALF_UserCallback(CPAL_InitTypeDef* pDevInitStruct) 00308 { 00309 00310 }*/ 00311 00312 00313 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/