Subversion Repositories LedShow

Rev

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

Rev 2 Rev 9
Line 38... Line 38...
38
    (#) Initialize the CEC registers by calling the HAL_CEC_Init() API.
38
    (#) Initialize the CEC registers by calling the HAL_CEC_Init() API.
39
 
39
 
40
  [..]        
40
  [..]        
41
    (@) This API (HAL_CEC_Init()) configures also the low level Hardware (GPIO, CLOCK, CORTEX...etc)
41
    (@) This API (HAL_CEC_Init()) configures also the low level Hardware (GPIO, CLOCK, CORTEX...etc)
42
        by calling the customed HAL_CEC_MspInit() API.
42
        by calling the customed HAL_CEC_MspInit() API.
-
 
43
  *** Callback registration ***
-
 
44
  =============================================
-
 
45
  The compilation define  USE_HAL_CEC_REGISTER_CALLBACKS when set to 1
-
 
46
  allows the user to configure dynamically the driver callbacks.
-
 
47
  Use Functions @ref HAL_CEC_RegisterCallback() or HAL_CEC_RegisterXXXCallback()
-
 
48
  to register an interrupt callback.
-
 
49
 
-
 
50
  Function @ref HAL_CEC_RegisterCallback() allows to register following callbacks:
-
 
51
    (+) TxCpltCallback     : Tx Transfer completed callback.
-
 
52
    (+) ErrorCallback      : callback for error detection.
-
 
53
    (+) MspInitCallback    : CEC MspInit.
-
 
54
    (+) MspDeInitCallback  : CEC MspDeInit.
-
 
55
  This function takes as parameters the HAL peripheral handle, the Callback ID
-
 
56
  and a pointer to the user callback function.
-
 
57
 
-
 
58
  For specific callback HAL_CEC_RxCpltCallback use dedicated register callbacks
-
 
59
  @ref HAL_CEC_RegisterRxCpltCallback().
-
 
60
 
-
 
61
  Use function @ref HAL_CEC_UnRegisterCallback() to reset a callback to the default
-
 
62
  weak function.
-
 
63
  @ref HAL_CEC_UnRegisterCallback() takes as parameters the HAL peripheral handle,
-
 
64
  and the Callback ID.
-
 
65
  This function allows to reset following callbacks:
-
 
66
    (+) TxCpltCallback     : Tx Transfer completed callback.
-
 
67
    (+) ErrorCallback      : callback for error detection.
-
 
68
    (+) MspInitCallback    : CEC MspInit.
-
 
69
    (+) MspDeInitCallback  : CEC MspDeInit.
-
 
70
 
-
 
71
  For callback HAL_CEC_RxCpltCallback use dedicated unregister callback :
-
 
72
  @ref HAL_CEC_UnRegisterRxCpltCallback().
-
 
73
 
-
 
74
  By default, after the @ref HAL_CEC_Init() and when the state is HAL_CEC_STATE_RESET
-
 
75
  all callbacks are set to the corresponding weak functions :
-
 
76
  examples @ref HAL_CEC_TxCpltCallback() , @ref HAL_CEC_RxCpltCallback().
-
 
77
  Exception done for MspInit and MspDeInit functions that are
-
 
78
  reset to the legacy weak function in the @ref HAL_CEC_Init()/ @ref HAL_CEC_DeInit() only when
-
 
79
  these callbacks are null (not registered beforehand).
-
 
80
  if not, MspInit or MspDeInit are not null, the @ref HAL_CEC_Init() / @ref HAL_CEC_DeInit()
-
 
81
  keep and use the user MspInit/MspDeInit functions (registered beforehand)
-
 
82
 
-
 
83
  Callbacks can be registered/unregistered in HAL_CEC_STATE_READY state only.
-
 
84
  Exception done MspInit/MspDeInit callbacks that can be registered/unregistered
-
 
85
  in HAL_CEC_STATE_READY or HAL_CEC_STATE_RESET state,
-
 
86
  thus registered (user) MspInit/DeInit callbacks can be used during the Init/DeInit.
-
 
87
  In that case first register the MspInit/MspDeInit user callbacks
-
 
88
  using @ref HAL_CEC_RegisterCallback() before calling @ref HAL_CEC_DeInit()
-
 
89
  or @ref HAL_CEC_Init() function.
43
 
90
 
-
 
91
  When the compilation define USE_HAL_CEC_REGISTER_CALLBACKS is set to 0 or
-
 
92
  not defined, the callback registration feature is not available and all callbacks
-
 
93
  are set to the corresponding weak functions.
44
  @endverbatim
94
  @endverbatim
45
  ******************************************************************************
95
  ******************************************************************************
46
  * @attention
96
  * @attention
47
  *
97
  *
48
  * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
98
  * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
49
  *
-
 
50
  * Redistribution and use in source and binary forms, with or without modification,
-
 
51
  * are permitted provided that the following conditions are met:
-
 
52
  *   1. Redistributions of source code must retain the above copyright notice,
-
 
53
  *      this list of conditions and the following disclaimer.
-
 
54
  *   2. Redistributions in binary form must reproduce the above copyright notice,
-
 
55
  *      this list of conditions and the following disclaimer in the documentation
-
 
56
  *      and/or other materials provided with the distribution.
-
 
57
  *   3. Neither the name of STMicroelectronics nor the names of its contributors
-
 
58
  *      may be used to endorse or promote products derived from this software
-
 
59
  *      without specific prior written permission.
99
  * All rights reserved.</center></h2>
60
  *
100
  *
61
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
101
  * This software component is licensed by ST under BSD 3-Clause license,
62
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-
 
63
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-
 
64
  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-
 
65
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-
 
66
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
102
  * the "License"; You may not use this file except in compliance with the
67
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
103
  * License. You may obtain a copy of the License at:
68
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-
 
69
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-
 
70
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
104
  *                        opensource.org/licenses/BSD-3-Clause
71
  *
105
  *
72
  ******************************************************************************  
106
  ******************************************************************************  
73
  */
107
  */
74
 
108
 
75
/* Includes ------------------------------------------------------------------*/
109
/* Includes ------------------------------------------------------------------*/
76
#include "stm32f1xx_hal.h"
110
#include "stm32f1xx_hal.h"
77
 
111
 
78
#ifdef HAL_CEC_MODULE_ENABLED
112
#ifdef HAL_CEC_MODULE_ENABLED
79
 
113
 
80
#if defined(STM32F100xB) || defined(STM32F100xE)
114
#if defined (CEC)
81
 
115
 
82
/** @addtogroup STM32F1xx_HAL_Driver
116
/** @addtogroup STM32F1xx_HAL_Driver
83
  * @{
117
  * @{
84
  */
118
  */
85
 
119
 
Line 155... Line 189...
155
  /* Check the parameters */
189
  /* Check the parameters */
156
  assert_param(IS_CEC_ALL_INSTANCE(hcec->Instance));
190
  assert_param(IS_CEC_ALL_INSTANCE(hcec->Instance));
157
  assert_param(IS_CEC_BIT_TIMING_ERROR_MODE(hcec->Init.TimingErrorFree));
191
  assert_param(IS_CEC_BIT_TIMING_ERROR_MODE(hcec->Init.TimingErrorFree));
158
  assert_param(IS_CEC_BIT_PERIOD_ERROR_MODE(hcec->Init.PeriodErrorFree));
192
  assert_param(IS_CEC_BIT_PERIOD_ERROR_MODE(hcec->Init.PeriodErrorFree));
159
  assert_param(IS_CEC_ADDRESS(hcec->Init.OwnAddress));
193
  assert_param(IS_CEC_ADDRESS(hcec->Init.OwnAddress));
-
 
194
#if (USE_HAL_CEC_REGISTER_CALLBACKS == 1)
-
 
195
  if(hcec->gState == HAL_CEC_STATE_RESET)
-
 
196
  {
-
 
197
    /* Allocate lock resource and initialize it */
-
 
198
    hcec->Lock = HAL_UNLOCKED;
-
 
199
 
-
 
200
    hcec->TxCpltCallback  = HAL_CEC_TxCpltCallback;  /* Legacy weak TxCpltCallback  */
-
 
201
    hcec->RxCpltCallback = HAL_CEC_RxCpltCallback;   /* Legacy weak RxCpltCallback */
-
 
202
    hcec->ErrorCallback = HAL_CEC_ErrorCallback;     /* Legacy weak ErrorCallback */
160
 
203
 
-
 
204
    if(hcec->MspInitCallback == NULL)
-
 
205
    {
-
 
206
      hcec->MspInitCallback = HAL_CEC_MspInit; /* Legacy weak MspInit  */
-
 
207
    }
-
 
208
 
-
 
209
    /* Init the low level hardware */
-
 
210
    hcec->MspInitCallback(hcec);
-
 
211
  }
-
 
212
#else
161
  if(hcec->gState == HAL_CEC_STATE_RESET)
213
  if(hcec->gState == HAL_CEC_STATE_RESET)
162
  {
214
  {
163
    /* Allocate lock resource and initialize it */
215
    /* Allocate lock resource and initialize it */
164
    hcec->Lock = HAL_UNLOCKED;
216
    hcec->Lock = HAL_UNLOCKED;
165
    /* Init the low level hardware : GPIO, CLOCK */
217
    /* Init the low level hardware : GPIO, CLOCK */
166
    HAL_CEC_MspInit(hcec);
218
    HAL_CEC_MspInit(hcec);
167
  }
219
  }
-
 
220
#endif /* USE_HAL_CEC_REGISTER_CALLBACKS */
-
 
221
 
168
  hcec->gState = HAL_CEC_STATE_BUSY;
222
  hcec->gState = HAL_CEC_STATE_BUSY;
169
 
223
 
170
  /* Disable the Peripheral */
224
  /* Disable the Peripheral */
171
  __HAL_CEC_DISABLE(hcec);
225
  __HAL_CEC_DISABLE(hcec);
172
 
226
 
Line 208... Line 262...
208
  /* Check the parameters */
262
  /* Check the parameters */
209
  assert_param(IS_CEC_ALL_INSTANCE(hcec->Instance));
263
  assert_param(IS_CEC_ALL_INSTANCE(hcec->Instance));
210
 
264
 
211
  hcec->gState = HAL_CEC_STATE_BUSY;
265
  hcec->gState = HAL_CEC_STATE_BUSY;
212
 
266
 
-
 
267
#if (USE_HAL_CEC_REGISTER_CALLBACKS == 1)
-
 
268
  if(hcec->MspDeInitCallback == NULL)
-
 
269
  {
-
 
270
    hcec->MspDeInitCallback = HAL_CEC_MspDeInit; /* Legacy weak MspDeInit  */
-
 
271
  }
-
 
272
 
-
 
273
  /* DeInit the low level hardware */
-
 
274
  hcec->MspDeInitCallback(hcec);
-
 
275
 
-
 
276
#else
213
  /* DeInit the low level hardware */
277
  /* DeInit the low level hardware */
214
  HAL_CEC_MspDeInit(hcec);
278
  HAL_CEC_MspDeInit(hcec);
-
 
279
#endif /* USE_HAL_CEC_REGISTER_CALLBACKS */
215
 
280
 
216
  __HAL_RCC_CEC_FORCE_RESET();
281
  __HAL_RCC_CEC_FORCE_RESET();
217
  __HAL_RCC_CEC_RELEASE_RESET();
282
  __HAL_RCC_CEC_RELEASE_RESET();
218
 
283
 
219
  hcec->ErrorCode = HAL_CEC_ERROR_NONE;
284
  hcec->ErrorCode = HAL_CEC_ERROR_NONE;
220
  hcec->gState = HAL_CEC_STATE_RESET;
285
  hcec->gState = HAL_CEC_STATE_RESET;
Line 299... Line 364...
299
  /* NOTE : This function should not be modified, when the callback is needed,
364
  /* NOTE : This function should not be modified, when the callback is needed,
300
            the HAL_CEC_MspDeInit can be implemented in the user file
365
            the HAL_CEC_MspDeInit can be implemented in the user file
301
   */
366
   */
302
}
367
}
303
 
368
 
-
 
369
#if (USE_HAL_CEC_REGISTER_CALLBACKS == 1)
-
 
370
/**
-
 
371
  * @brief  Register a User CEC Callback
-
 
372
  *         To be used instead of the weak predefined callback
-
 
373
  * @param  hcec CEC handle
-
 
374
  * @param  CallbackID ID of the callback to be registered
-
 
375
  *         This parameter can be one of the following values:
-
 
376
  *          @arg @ref HAL_CEC_TX_CPLT_CB_ID Tx Complete callback ID
-
 
377
  *          @arg @ref HAL_CEC_ERROR_CB_ID Error callback ID
-
 
378
  *          @arg @ref HAL_CEC_MSPINIT_CB_ID MspInit callback ID
-
 
379
  *          @arg @ref HAL_CEC_MSPDEINIT_CB_ID MspDeInit callback ID
-
 
380
  * @param  pCallback pointer to the Callback function
-
 
381
  * @retval HAL status
-
 
382
  */
-
 
383
HAL_StatusTypeDef HAL_CEC_RegisterCallback(CEC_HandleTypeDef *hcec, HAL_CEC_CallbackIDTypeDef CallbackID, pCEC_CallbackTypeDef pCallback)
-
 
384
{
-
 
385
  HAL_StatusTypeDef status = HAL_OK;
-
 
386
 
-
 
387
  if(pCallback == NULL)
-
 
388
  {
-
 
389
    /* Update the error code */
-
 
390
    hcec->ErrorCode |= HAL_CEC_ERROR_INVALID_CALLBACK;
-
 
391
    return HAL_ERROR;
-
 
392
  }
-
 
393
    /* Process locked */
-
 
394
  __HAL_LOCK(hcec);
-
 
395
 
-
 
396
  if(hcec->gState == HAL_CEC_STATE_READY)
-
 
397
  {
-
 
398
    switch (CallbackID)
-
 
399
    {
-
 
400
    case HAL_CEC_TX_CPLT_CB_ID :
-
 
401
      hcec->TxCpltCallback = pCallback;
-
 
402
      break;
-
 
403
 
-
 
404
    case HAL_CEC_ERROR_CB_ID :
-
 
405
      hcec->ErrorCallback = pCallback;
-
 
406
      break;
-
 
407
 
-
 
408
    case HAL_CEC_MSPINIT_CB_ID :
-
 
409
      hcec->MspInitCallback = pCallback;
-
 
410
      break;
-
 
411
 
-
 
412
   case HAL_CEC_MSPDEINIT_CB_ID :
-
 
413
      hcec->MspDeInitCallback = pCallback;
-
 
414
      break;
-
 
415
 
-
 
416
    default :
-
 
417
      /* Update the error code */
-
 
418
      hcec->ErrorCode |= HAL_CEC_ERROR_INVALID_CALLBACK;
-
 
419
      /* Return error status */
-
 
420
      status =  HAL_ERROR;
-
 
421
      break;
-
 
422
    }
-
 
423
  }
-
 
424
  else if(hcec->gState == HAL_CEC_STATE_RESET)
-
 
425
  {
-
 
426
    switch (CallbackID)
-
 
427
    {
-
 
428
    case HAL_CEC_MSPINIT_CB_ID :
-
 
429
      hcec->MspInitCallback = pCallback;
-
 
430
      break;
-
 
431
 
-
 
432
   case HAL_CEC_MSPDEINIT_CB_ID :
-
 
433
      hcec->MspDeInitCallback = pCallback;
-
 
434
      break;
-
 
435
 
-
 
436
    default :
-
 
437
      /* Update the error code */
-
 
438
      hcec->ErrorCode |= HAL_CEC_ERROR_INVALID_CALLBACK;
-
 
439
     /* Return error status */
-
 
440
      status =  HAL_ERROR;
-
 
441
      break;
-
 
442
    }
-
 
443
  }
-
 
444
  else
-
 
445
  {
-
 
446
    /* Update the error code */
-
 
447
    hcec->ErrorCode |= HAL_CEC_ERROR_INVALID_CALLBACK;
-
 
448
    /* Return error status */
-
 
449
    status =  HAL_ERROR;
-
 
450
  }
-
 
451
 
-
 
452
  /* Release Lock */
-
 
453
  __HAL_UNLOCK(hcec);
-
 
454
 
-
 
455
  return status;
-
 
456
}
-
 
457
 
-
 
458
/**
-
 
459
  * @brief  Unregister an CEC Callback
-
 
460
  *         CEC callabck is redirected to the weak predefined callback
-
 
461
  * @param hcec uart handle
-
 
462
  * @param CallbackID ID of the callback to be unregistered
-
 
463
  *         This parameter can be one of the following values:
-
 
464
  *          @arg @ref HAL_CEC_TX_CPLT_CB_ID Tx Complete callback IDD
-
 
465
  *          @arg @ref HAL_CEC_ERROR_CB_ID Error callback ID
-
 
466
  *          @arg @ref HAL_CEC_MSPINIT_CB_ID MspInit callback ID
-
 
467
  *          @arg @ref HAL_CEC_MSPDEINIT_CB_ID MspDeInit callback ID
-
 
468
  * @retval status
-
 
469
  */
-
 
470
HAL_StatusTypeDef HAL_CEC_UnRegisterCallback(CEC_HandleTypeDef *hcec, HAL_CEC_CallbackIDTypeDef CallbackID)
-
 
471
{
-
 
472
  HAL_StatusTypeDef status = HAL_OK;
-
 
473
 
-
 
474
  /* Process locked */
-
 
475
  __HAL_LOCK(hcec);
-
 
476
 
-
 
477
  if(hcec->gState == HAL_CEC_STATE_READY)
-
 
478
  {
-
 
479
    switch (CallbackID)
-
 
480
    {
-
 
481
    case HAL_CEC_TX_CPLT_CB_ID :
-
 
482
      hcec->TxCpltCallback = HAL_CEC_TxCpltCallback;  /* Legacy weak  TxCpltCallback */
-
 
483
      break;
-
 
484
 
-
 
485
    case HAL_CEC_ERROR_CB_ID :
-
 
486
      hcec->ErrorCallback = HAL_CEC_ErrorCallback;  /* Legacy weak ErrorCallback   */
-
 
487
      break;
-
 
488
 
-
 
489
    case HAL_CEC_MSPINIT_CB_ID :
-
 
490
      hcec->MspInitCallback = HAL_CEC_MspInit;
-
 
491
      break;
-
 
492
 
-
 
493
   case HAL_CEC_MSPDEINIT_CB_ID :
-
 
494
      hcec->MspDeInitCallback = HAL_CEC_MspDeInit;
-
 
495
      break;
-
 
496
 
-
 
497
    default :
-
 
498
      /* Update the error code */
-
 
499
      hcec->ErrorCode |= HAL_CEC_ERROR_INVALID_CALLBACK;
-
 
500
     /* Return error status */
-
 
501
      status =  HAL_ERROR;
-
 
502
      break;
-
 
503
    }
-
 
504
  }
-
 
505
  else if(hcec->gState == HAL_CEC_STATE_RESET)
-
 
506
  {
-
 
507
    switch (CallbackID)
-
 
508
    {
-
 
509
    case HAL_CEC_MSPINIT_CB_ID :
-
 
510
      hcec->MspInitCallback = HAL_CEC_MspInit;
-
 
511
      break;
-
 
512
 
-
 
513
   case HAL_CEC_MSPDEINIT_CB_ID :
-
 
514
      hcec->MspDeInitCallback = HAL_CEC_MspDeInit;
-
 
515
      break;
-
 
516
 
-
 
517
    default :
-
 
518
      /* Update the error code */
-
 
519
      hcec->ErrorCode |= HAL_CEC_ERROR_INVALID_CALLBACK;
-
 
520
     /* Return error status */
-
 
521
      status =  HAL_ERROR;
-
 
522
      break;
-
 
523
    }
-
 
524
  }
-
 
525
  else
-
 
526
  {
-
 
527
    /* Update the error code */
-
 
528
    hcec->ErrorCode |= HAL_CEC_ERROR_INVALID_CALLBACK;
-
 
529
    /* Return error status */
-
 
530
    status =  HAL_ERROR;
-
 
531
  }
-
 
532
 
-
 
533
  /* Release Lock */
-
 
534
  __HAL_UNLOCK(hcec);
-
 
535
 
-
 
536
  return status;
-
 
537
}
-
 
538
 
-
 
539
/**
-
 
540
  * @brief  Register CEC RX complete Callback
-
 
541
  *         To be used instead of the weak HAL_CEC_RxCpltCallback() predefined callback
-
 
542
  * @param  hcec CEC handle
-
 
543
  * @param  pCallback pointer to the Rx transfer compelete Callback function
-
 
544
  * @retval HAL status
-
 
545
  */
-
 
546
HAL_StatusTypeDef HAL_CEC_RegisterRxCpltCallback(CEC_HandleTypeDef *hcec, pCEC_RxCallbackTypeDef pCallback)
-
 
547
{
-
 
548
  HAL_StatusTypeDef status = HAL_OK;
-
 
549
 
-
 
550
  if(pCallback == NULL)
-
 
551
  {
-
 
552
    /* Update the error code */
-
 
553
    hcec->ErrorCode |= HAL_CEC_ERROR_INVALID_CALLBACK;
-
 
554
    return HAL_ERROR;
-
 
555
  }
-
 
556
  /* Process locked */
-
 
557
  __HAL_LOCK(hcec);
-
 
558
 
-
 
559
  if(HAL_CEC_STATE_READY == hcec->RxState)
-
 
560
  {
-
 
561
    hcec->RxCpltCallback = pCallback;
-
 
562
  }
-
 
563
  else
-
 
564
  {
-
 
565
    /* Update the error code */
-
 
566
    hcec->ErrorCode |= HAL_CEC_ERROR_INVALID_CALLBACK;
-
 
567
    /* Return error status */
-
 
568
    status =  HAL_ERROR;
-
 
569
  }
-
 
570
 
-
 
571
  /* Release Lock */
-
 
572
  __HAL_UNLOCK(hcec);
-
 
573
  return status;
-
 
574
}
-
 
575
 
-
 
576
/**
-
 
577
  * @brief  UnRegister CEC RX complete Callback
-
 
578
  *         CEC RX complete Callback is redirected to the weak HAL_CEC_RxCpltCallback() predefined callback
-
 
579
  * @param  hcec CEC handle
-
 
580
  * @retval HAL status
-
 
581
  */
-
 
582
HAL_StatusTypeDef HAL_CEC_UnRegisterRxCpltCallback(CEC_HandleTypeDef *hcec)
-
 
583
{
-
 
584
  HAL_StatusTypeDef status = HAL_OK;
-
 
585
 
-
 
586
  /* Process locked */
-
 
587
  __HAL_LOCK(hcec);
-
 
588
 
-
 
589
  if(HAL_CEC_STATE_READY == hcec->RxState)
-
 
590
  {
-
 
591
    hcec->RxCpltCallback = HAL_CEC_RxCpltCallback; /* Legacy weak  CEC RxCpltCallback  */
-
 
592
  }
-
 
593
  else
-
 
594
  {
-
 
595
    /* Update the error code */
-
 
596
    hcec->ErrorCode |= HAL_CEC_ERROR_INVALID_CALLBACK;
-
 
597
    /* Return error status */
-
 
598
    status =  HAL_ERROR;
-
 
599
  }
-
 
600
 
-
 
601
  /* Release Lock */
-
 
602
  __HAL_UNLOCK(hcec);
-
 
603
  return status;
-
 
604
}
-
 
605
#endif /* USE_HAL_CEC_REGISTER_CALLBACKS */
-
 
606
 
304
/**
607
/**
305
  * @}
608
  * @}
306
  */
609
  */
307
 
610
 
308
/** @defgroup CEC_Exported_Functions_Group2 Input and Output operation functions
611
/** @defgroup CEC_Exported_Functions_Group2 Input and Output operation functions
Line 454... Line 757...
454
  }
757
  }
455
 
758
 
456
  if((hcec->ErrorCode & CEC_ESR_ALL_ERROR) != 0U)
759
  if((hcec->ErrorCode & CEC_ESR_ALL_ERROR) != 0U)
457
  {
760
  {
458
    /* Error  Call Back */
761
    /* Error  Call Back */
-
 
762
#if (USE_HAL_CEC_REGISTER_CALLBACKS == 1)
-
 
763
    hcec->ErrorCallback(hcec);
-
 
764
#else    
459
    HAL_CEC_ErrorCallback(hcec);
765
    HAL_CEC_ErrorCallback(hcec);
-
 
766
#endif /* USE_HAL_CEC_REGISTER_CALLBACKS */
460
  }
767
  }
461
 
768
 
462
  /* Transmit byte request or block transfer finished */
769
  /* Transmit byte request or block transfer finished */
463
  if(__HAL_CEC_GET_FLAG(hcec, CEC_FLAG_TBTRF) != RESET)
770
  if(__HAL_CEC_GET_FLAG(hcec, CEC_FLAG_TBTRF) != RESET)
464
  {
771
  {
Line 595... Line 902...
595
    {
902
    {
596
      /* Acknowledge successful completion by writing 0x00 */
903
      /* Acknowledge successful completion by writing 0x00 */
597
      MODIFY_REG(hcec->Instance->CSR, CEC_FLAG_TRANSMIT_MASK, 0x00U);
904
      MODIFY_REG(hcec->Instance->CSR, CEC_FLAG_TRANSMIT_MASK, 0x00U);
598
 
905
 
599
      hcec->gState = HAL_CEC_STATE_READY;
906
      hcec->gState = HAL_CEC_STATE_READY;
-
 
907
#if (USE_HAL_CEC_REGISTER_CALLBACKS == 1)
-
 
908
     hcec->TxCpltCallback(hcec);
600
     
909
#else
601
      HAL_CEC_TxCpltCallback(hcec);
910
     HAL_CEC_TxCpltCallback(hcec);
-
 
911
#endif /* USE_HAL_CEC_REGISTER_CALLBACKS */     
602
     
912
     
603
      return HAL_OK;
913
      return HAL_OK;
604
    }
914
    }
605
    else
915
    else
606
    {
916
    {
Line 656... Line 966...
656
    /* If the End Of Message is reached */
966
    /* If the End Of Message is reached */
657
    if(HAL_IS_BIT_SET(temp, CEC_FLAG_REOM))
967
    if(HAL_IS_BIT_SET(temp, CEC_FLAG_REOM))
658
    {
968
    {
659
      /* Interrupts are not disabled due to transmission still ongoing */
969
      /* Interrupts are not disabled due to transmission still ongoing */
660
      hcec->RxState = HAL_CEC_STATE_READY;
970
      hcec->RxState = HAL_CEC_STATE_READY;
-
 
971
#if (USE_HAL_CEC_REGISTER_CALLBACKS == 1)
-
 
972
    hcec->RxCpltCallback(hcec, hcec->RxXferSize);
661
     
973
#else
662
      HAL_CEC_RxCpltCallback(hcec, hcec->RxXferSize);
974
    HAL_CEC_RxCpltCallback(hcec, hcec->RxXferSize);
-
 
975
#endif /* USE_HAL_CEC_REGISTER_CALLBACKS */      
663
     
976
     
664
      return HAL_OK;
977
      return HAL_OK;
665
    }
978
    }
666
    else
979
    else
667
    {
980
    {
Line 680... Line 993...
680
 
993
 
681
/**
994
/**
682
  * @}
995
  * @}
683
  */
996
  */
684
 
997
 
685
#endif /* defined(STM32F100xB) || defined(STM32F100xE) */
998
#endif /* CEC */
686
 
999
 
687
#endif /* HAL_CEC_MODULE_ENABLED */
1000
#endif /* HAL_CEC_MODULE_ENABLED */
688
/**
1001
/**
689
  * @}
1002
  * @}
690
  */
1003
  */