You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

136 lines
3.9 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32h7xx_hal_dfsdm_ex.c
  4. * @author MCD Application Team
  5. * @brief DFSDM Extended HAL module driver.
  6. * This file provides firmware functions to manage the following
  7. * functionality of the DFSDM Peripheral Controller:
  8. * + Set and get pulses skipping on channel.
  9. *
  10. ******************************************************************************
  11. * @attention
  12. *
  13. * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
  14. * All rights reserved.</center></h2>
  15. *
  16. * This software component is licensed by ST under BSD 3-Clause license,
  17. * the "License"; You may not use this file except in compliance with the
  18. * License. You may obtain a copy of the License at:
  19. * opensource.org/licenses/BSD-3-Clause
  20. *
  21. ******************************************************************************
  22. */
  23. /* Includes ------------------------------------------------------------------*/
  24. #include "stm32h7xx_hal.h"
  25. /** @addtogroup STM32H7xx_HAL_Driver
  26. * @{
  27. */
  28. #ifdef HAL_DFSDM_MODULE_ENABLED
  29. #if defined(DFSDM_CHDLYR_PLSSKP)
  30. /** @defgroup DFSDMEx DFSDMEx
  31. * @brief DFSDM Extended HAL module driver
  32. * @{
  33. */
  34. /* Private types -------------------------------------------------------------*/
  35. /* Private variables ---------------------------------------------------------*/
  36. /* Private constants ---------------------------------------------------------*/
  37. /* Private macros ------------------------------------------------------------*/
  38. /* Private functions ---------------------------------------------------------*/
  39. /* Exported functions --------------------------------------------------------*/
  40. /** @defgroup DFSDMEx_Exported_Functions DFSDM Extended Exported Functions
  41. * @{
  42. */
  43. /** @defgroup DFSDMEx_Exported_Functions_Group1_Channel Extended channel operation functions
  44. * @brief DFSDM extended channel operation functions
  45. *
  46. @verbatim
  47. ===============================================================================
  48. ##### Extended channel operation functions #####
  49. ===============================================================================
  50. [..] This section provides functions allowing to:
  51. (+) Set and get value of pulses skipping on channel
  52. @endverbatim
  53. * @{
  54. */
  55. /**
  56. * @brief Set value of pulses skipping.
  57. * @param hdfsdm_channel DFSDM channel handle.
  58. * @param PulsesValue Value of pulses to be skipped.
  59. * This parameter must be a number between Min_Data = 0 and Max_Data = 63.
  60. * @retval HAL status.
  61. */
  62. HAL_StatusTypeDef HAL_DFDSMEx_ChannelSetPulsesSkipping(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t PulsesValue)
  63. {
  64. HAL_StatusTypeDef status = HAL_OK;
  65. /* Check pulses value */
  66. assert_param(IS_DFSDM_CHANNEL_SKIPPING_VALUE(PulsesValue));
  67. /* Check DFSDM channel state */
  68. if (hdfsdm_channel->State == HAL_DFSDM_CHANNEL_STATE_READY)
  69. {
  70. /* Set new value of pulses skipping */
  71. hdfsdm_channel->Instance->CHDLYR = (PulsesValue & DFSDM_CHDLYR_PLSSKP);
  72. }
  73. else
  74. {
  75. status = HAL_ERROR;
  76. }
  77. return status;
  78. }
  79. /**
  80. * @brief Get value of pulses skipping.
  81. * @param hdfsdm_channel DFSDM channel handle.
  82. * @param PulsesValue Value of pulses to be skipped.
  83. * @retval HAL status.
  84. */
  85. HAL_StatusTypeDef HAL_DFDSMEx_ChannelGetPulsesSkipping(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t *PulsesValue)
  86. {
  87. HAL_StatusTypeDef status = HAL_OK;
  88. /* Check DFSDM channel state */
  89. if (hdfsdm_channel->State == HAL_DFSDM_CHANNEL_STATE_READY)
  90. {
  91. /* Get value of remaining pulses to be skipped */
  92. *PulsesValue = (hdfsdm_channel->Instance->CHDLYR & DFSDM_CHDLYR_PLSSKP);
  93. }
  94. else
  95. {
  96. status = HAL_ERROR;
  97. }
  98. return status;
  99. }
  100. /**
  101. * @}
  102. */
  103. /**
  104. * @}
  105. */
  106. /**
  107. * @}
  108. */
  109. #endif /* DFSDM_CHDLYR_PLSSKP */
  110. #endif /* HAL_DFSDM_MODULE_ENABLED */
  111. /**
  112. * @}
  113. */
  114. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/