Subversion Repositories LedShow

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 9
Line 4... Line 4...
4
  * @author  MCD Application Team
4
  * @author  MCD Application Team
5
  * @brief   Header file of CEC HAL module.
5
  * @brief   Header file of CEC HAL module.
6
  ******************************************************************************
6
  ******************************************************************************
7
  * @attention
7
  * @attention
8
  *
8
  *
9
  * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
9
  * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
-
 
10
  * All rights reserved.</center></h2>
10
  *
11
  *
11
  * Redistribution and use in source and binary forms, with or without modification,
12
  * This software component is licensed by ST under BSD 3-Clause license,
12
  * are permitted provided that the following conditions are met:
13
  * the "License"; You may not use this file except in compliance with the
13
  *   1. Redistributions of source code must retain the above copyright notice,
-
 
14
  *      this list of conditions and the following disclaimer.
-
 
15
  *   2. Redistributions in binary form must reproduce the above copyright notice,
-
 
16
  *      this list of conditions and the following disclaimer in the documentation
-
 
17
  *      and/or other materials provided with the distribution.
14
  * License. You may obtain a copy of the License at:
18
  *   3. Neither the name of STMicroelectronics nor the names of its contributors
-
 
19
  *      may be used to endorse or promote products derived from this software
15
  *                        opensource.org/licenses/BSD-3-Clause
20
  *      without specific prior written permission.
-
 
21
  *
-
 
22
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-
 
23
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-
 
24
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-
 
25
  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-
 
26
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-
 
27
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-
 
28
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-
 
29
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-
 
30
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-
 
31
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
32
  *
16
  *
33
  ******************************************************************************  
17
  ******************************************************************************  
34
  */
18
  */
35
 
19
 
36
/* Define to prevent recursive inclusion -------------------------------------*/
20
/* Define to prevent recursive inclusion -------------------------------------*/
Line 39... Line 23...
39
 
23
 
40
#ifdef __cplusplus
24
#ifdef __cplusplus
41
 extern "C" {
25
 extern "C" {
42
#endif
26
#endif
43
 
27
 
44
#if defined(STM32F100xB) || defined(STM32F100xE)
-
 
45
/* Includes ------------------------------------------------------------------*/
28
/* Includes ------------------------------------------------------------------*/
46
#include "stm32f1xx_hal_def.h"
29
#include "stm32f1xx_hal_def.h"
47
 
30
 
-
 
31
#if defined (CEC)
-
 
32
 
48
/** @addtogroup STM32F1xx_HAL_Driver
33
/** @addtogroup STM32F1xx_HAL_Driver
49
  * @{
34
  * @{
50
  */
35
  */
51
 
36
 
52
/** @addtogroup CEC
37
/** @addtogroup CEC
Line 128... Line 113...
128
}HAL_CEC_StateTypeDef;
113
}HAL_CEC_StateTypeDef;
129
 
114
 
130
/**
115
/**
131
  * @brief  CEC handle Structure definition  
116
  * @brief  CEC handle Structure definition  
132
  */  
117
  */  
133
typedef struct
118
typedef struct __CEC_HandleTypeDef
134
{
119
{
135
  CEC_TypeDef             *Instance;      /*!< CEC registers base address */
120
  CEC_TypeDef             *Instance;      /*!< CEC registers base address */
136
 
121
 
137
  CEC_InitTypeDef         Init;           /*!< CEC communication parameters */
122
  CEC_InitTypeDef         Init;           /*!< CEC communication parameters */
138
 
123
 
Line 150... Line 135...
150
 
135
 
151
  HAL_CEC_StateTypeDef    RxState;        /*!< CEC state information related to Rx operations.
136
  HAL_CEC_StateTypeDef    RxState;        /*!< CEC state information related to Rx operations.
152
                                               This parameter can be a value of @ref HAL_CEC_StateTypeDef */
137
                                               This parameter can be a value of @ref HAL_CEC_StateTypeDef */
153
 
138
 
154
  uint32_t                ErrorCode;      /*!< For errors handling purposes, copy of ISR register
139
  uint32_t                ErrorCode;      /*!< For errors handling purposes, copy of ISR register
155
                                               in case error is reported */    
140
                                               in case error is reported */  
-
 
141
 
-
 
142
#if (USE_HAL_CEC_REGISTER_CALLBACKS == 1)
-
 
143
  void  (* TxCpltCallback) ( struct __CEC_HandleTypeDef * hcec);                            /*!< CEC Tx Transfer completed callback */
-
 
144
  void  (* RxCpltCallback) ( struct __CEC_HandleTypeDef * hcec, uint32_t RxFrameSize);      /*!< CEC Rx Transfer completed callback */
-
 
145
  void  (* ErrorCallback)  ( struct __CEC_HandleTypeDef * hcec);                            /*!< CEC error callback */
-
 
146
 
-
 
147
  void  (* MspInitCallback)        ( struct __CEC_HandleTypeDef * hcec);    /*!< CEC Msp Init callback              */
-
 
148
  void  (* MspDeInitCallback)      ( struct __CEC_HandleTypeDef * hcec);    /*!< CEC Msp DeInit callback            */
-
 
149
 
-
 
150
#endif /* (USE_HAL_CEC_REGISTER_CALLBACKS) */                                                                                      
156
}CEC_HandleTypeDef;
151
}CEC_HandleTypeDef;
-
 
152
 
-
 
153
#if (USE_HAL_CEC_REGISTER_CALLBACKS == 1)
-
 
154
/**
-
 
155
  * @brief  HAL CEC Callback ID enumeration definition
-
 
156
  */
-
 
157
typedef enum
-
 
158
{
-
 
159
  HAL_CEC_TX_CPLT_CB_ID      = 0x00U,    /*!< CEC Tx Transfer completed callback ID  */
-
 
160
  HAL_CEC_RX_CPLT_CB_ID      = 0x01U,    /*!< CEC Rx Transfer completed callback ID  */
-
 
161
  HAL_CEC_ERROR_CB_ID        = 0x02U,    /*!< CEC error callback  ID                 */
-
 
162
  HAL_CEC_MSPINIT_CB_ID      = 0x03U,    /*!< CEC Msp Init callback ID               */
-
 
163
  HAL_CEC_MSPDEINIT_CB_ID    = 0x04U     /*!< CEC Msp DeInit callback ID             */
-
 
164
}HAL_CEC_CallbackIDTypeDef;
-
 
165
 
-
 
166
/**
-
 
167
  * @brief  HAL CEC Callback pointer definition
-
 
168
  */
-
 
169
typedef  void (*pCEC_CallbackTypeDef)(CEC_HandleTypeDef * hcec); /*!< pointer to an CEC callback function */
-
 
170
typedef  void (*pCEC_RxCallbackTypeDef)(CEC_HandleTypeDef * hcec, uint32_t RxFrameSize); /*!< pointer to an Rx Transfer completed callback function */
-
 
171
#endif /* USE_HAL_CEC_REGISTER_CALLBACKS */
157
/**
172
/**
158
  * @}
173
  * @}
159
  */
174
  */
160
 
175
 
161
/* Exported constants --------------------------------------------------------*/
176
/* Exported constants --------------------------------------------------------*/
Line 172... Line 187...
172
#define HAL_CEC_ERROR_RBTFE  CEC_ESR_RBTFE  /*!< Rx Block Transfer Finished Error */
187
#define HAL_CEC_ERROR_RBTFE  CEC_ESR_RBTFE  /*!< Rx Block Transfer Finished Error */
173
#define HAL_CEC_ERROR_SBE    CEC_ESR_SBE    /*!< Start Bit Error */
188
#define HAL_CEC_ERROR_SBE    CEC_ESR_SBE    /*!< Start Bit Error */
174
#define HAL_CEC_ERROR_ACKE   CEC_ESR_ACKE   /*!< Block Acknowledge Error */
189
#define HAL_CEC_ERROR_ACKE   CEC_ESR_ACKE   /*!< Block Acknowledge Error */
175
#define HAL_CEC_ERROR_LINE   CEC_ESR_LINE   /*!< Line Error */
190
#define HAL_CEC_ERROR_LINE   CEC_ESR_LINE   /*!< Line Error */
176
#define HAL_CEC_ERROR_TBTFE  CEC_ESR_TBTFE  /*!< Tx Block Transfer Finished Error */
191
#define HAL_CEC_ERROR_TBTFE  CEC_ESR_TBTFE  /*!< Tx Block Transfer Finished Error */
-
 
192
#if (USE_HAL_CEC_REGISTER_CALLBACKS == 1)
-
 
193
#define  HAL_CEC_ERROR_INVALID_CALLBACK ((uint32_t)0x00000080U) /*!< Invalid Callback Error  */
-
 
194
#endif /* USE_HAL_CEC_REGISTER_CALLBACKS */
177
/**
195
/**
178
  * @}
196
  * @}
179
  */
197
  */
180
 
198
 
181
/** @defgroup CEC_BitTimingErrorMode Bit Timing Error Mode
199
/** @defgroup CEC_BitTimingErrorMode Bit Timing Error Mode
Line 262... Line 280...
262
 
280
 
263
/** @brief  Reset CEC handle gstate & RxState
281
/** @brief  Reset CEC handle gstate & RxState
264
  * @param  __HANDLE__: CEC handle.
282
  * @param  __HANDLE__: CEC handle.
265
  * @retval None
283
  * @retval None
266
  */
284
  */
-
 
285
#if (USE_HAL_CEC_REGISTER_CALLBACKS == 1)
267
#define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) do{                                                   \
286
#define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) do{                                                   \
268
                                                       (__HANDLE__)->gState = HAL_CEC_STATE_RESET;     \
287
                                                       (__HANDLE__)->gState = HAL_CEC_STATE_RESET;     \
269
                                                       (__HANDLE__)->RxState = HAL_CEC_STATE_RESET;    \
288
                                                       (__HANDLE__)->RxState = HAL_CEC_STATE_RESET;    \
-
 
289
                                                       (__HANDLE__)->MspInitCallback = NULL;           \
-
 
290
                                                       (__HANDLE__)->MspDeInitCallback = NULL;         \
270
                                                     } while(0U)
291
                                                     } while(0)
-
 
292
#else  
-
 
293
#define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) do{                                                   \
-
 
294
                                                       (__HANDLE__)->gState = HAL_CEC_STATE_RESET;     \
-
 
295
                                                       (__HANDLE__)->RxState = HAL_CEC_STATE_RESET;    \
-
 
296
                                                     } while(0)
-
 
297
#endif /* USE_HAL_CEC_REGISTER_CALLBACKS */
271
 
298
 
272
/** @brief  Checks whether or not the specified CEC interrupt flag is set.
299
/** @brief  Checks whether or not the specified CEC interrupt flag is set.
273
  * @param  __HANDLE__: specifies the CEC Handle.
300
  * @param  __HANDLE__: specifies the CEC Handle.
274
  * @param  __FLAG__: specifies the flag to check.
301
  * @param  __FLAG__: specifies the flag to check.
275
  *     @arg CEC_FLAG_TERR: Tx Error
302
  *     @arg CEC_FLAG_TERR: Tx Error
Line 373... Line 400...
373
  */
400
  */
374
#define __HAL_CEC_SET_OAR(__HANDLE__,__ADDRESS__) MODIFY_REG((__HANDLE__)->Instance->OAR, CEC_OAR_OA, (__ADDRESS__));
401
#define __HAL_CEC_SET_OAR(__HANDLE__,__ADDRESS__) MODIFY_REG((__HANDLE__)->Instance->OAR, CEC_OAR_OA, (__ADDRESS__));
375
 
402
 
376
/**
403
/**
377
  * @}
404
  * @}
378
  */                      
405
  */
379
 
406
 
380
/* Exported functions --------------------------------------------------------*/
407
/* Exported functions --------------------------------------------------------*/
381
/** @addtogroup CEC_Exported_Functions CEC Exported Functions
408
/** @addtogroup CEC_Exported_Functions CEC Exported Functions
382
  * @{
409
  * @{
383
  */
410
  */
Line 390... Line 417...
390
HAL_StatusTypeDef HAL_CEC_Init(CEC_HandleTypeDef *hcec);
417
HAL_StatusTypeDef HAL_CEC_Init(CEC_HandleTypeDef *hcec);
391
HAL_StatusTypeDef HAL_CEC_DeInit(CEC_HandleTypeDef *hcec);
418
HAL_StatusTypeDef HAL_CEC_DeInit(CEC_HandleTypeDef *hcec);
392
HAL_StatusTypeDef HAL_CEC_SetDeviceAddress(CEC_HandleTypeDef *hcec, uint16_t CEC_OwnAddress);
419
HAL_StatusTypeDef HAL_CEC_SetDeviceAddress(CEC_HandleTypeDef *hcec, uint16_t CEC_OwnAddress);
393
void HAL_CEC_MspInit(CEC_HandleTypeDef *hcec);
420
void HAL_CEC_MspInit(CEC_HandleTypeDef *hcec);
394
void HAL_CEC_MspDeInit(CEC_HandleTypeDef *hcec);
421
void HAL_CEC_MspDeInit(CEC_HandleTypeDef *hcec);
-
 
422
#if (USE_HAL_CEC_REGISTER_CALLBACKS == 1)
-
 
423
HAL_StatusTypeDef HAL_CEC_RegisterCallback(CEC_HandleTypeDef *hcec, HAL_CEC_CallbackIDTypeDef CallbackID, pCEC_CallbackTypeDef pCallback);
-
 
424
HAL_StatusTypeDef HAL_CEC_UnRegisterCallback(CEC_HandleTypeDef *hcec, HAL_CEC_CallbackIDTypeDef CallbackID);
-
 
425
 
-
 
426
HAL_StatusTypeDef HAL_CEC_RegisterRxCpltCallback(CEC_HandleTypeDef *hcec, pCEC_RxCallbackTypeDef pCallback);
-
 
427
HAL_StatusTypeDef HAL_CEC_UnRegisterRxCpltCallback(CEC_HandleTypeDef *hcec);
-
 
428
#endif /* USE_HAL_CEC_REGISTER_CALLBACKS */
395
/**
429
/**
396
  * @}
430
  * @}
397
  */
431
  */
398
 
432
 
399
/** @addtogroup CEC_Exported_Functions_Group2 Input and Output operation functions
433
/** @addtogroup CEC_Exported_Functions_Group2 Input and Output operation functions
Line 504... Line 538...
504
  */
538
  */
505
 
539
 
506
/**
540
/**
507
  * @}
541
  * @}
508
  */
542
  */
-
 
543
 
509
#endif /* defined(STM32F100xB) || defined(STM32F100xE) */
544
#endif /* CEC */
-
 
545
 
510
#ifdef __cplusplus
546
#ifdef __cplusplus
511
}
547
}
512
#endif
548
#endif
513
 
549
 
514
#endif /* __STM32F1xx_HAL_CEC_H */
550
#endif /* __STM32F1xx_HAL_CEC_H */