hal_adc_lld.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /**
  14. * @file hal_adc_lld.c
  15. * @brief PLATFORM ADC subsystem low level driver source.
  16. *
  17. * @addtogroup ADC
  18. * @{
  19. */
  20. #include "hal.h"
  21. #if (HAL_USE_ADC == TRUE) || defined(__DOXYGEN__)
  22. /*===========================================================================*/
  23. /* Driver local definitions. */
  24. /*===========================================================================*/
  25. /*===========================================================================*/
  26. /* Driver exported variables. */
  27. /*===========================================================================*/
  28. /**
  29. * @brief ADC1 driver identifier.
  30. */
  31. #if (PLATFORM_ADC_USE_ADC1 == TRUE) || defined(__DOXYGEN__)
  32. ADCDriver ADCD1;
  33. #endif
  34. /*===========================================================================*/
  35. /* Driver local variables and types. */
  36. /*===========================================================================*/
  37. /*===========================================================================*/
  38. /* Driver local functions. */
  39. /*===========================================================================*/
  40. /*===========================================================================*/
  41. /* Driver interrupt handlers. */
  42. /*===========================================================================*/
  43. /*===========================================================================*/
  44. /* Driver exported functions. */
  45. /*===========================================================================*/
  46. /**
  47. * @brief Low level ADC driver initialization.
  48. *
  49. * @notapi
  50. */
  51. void adc_lld_init(void) {
  52. #if PLATFORM_ADC_USE_ADC1 == TRUE
  53. /* Driver initialization.*/
  54. adcObjectInit(&ADCD1);
  55. #endif
  56. }
  57. /**
  58. * @brief Configures and activates the ADC peripheral.
  59. *
  60. * @param[in] adcp pointer to the @p ADCDriver object
  61. *
  62. * @notapi
  63. */
  64. void adc_lld_start(ADCDriver *adcp) {
  65. if (adcp->state == ADC_STOP) {
  66. /* Enables the peripheral.*/
  67. #if PLATFORM_ADC_USE_ADC1 == TRUE
  68. if (&ADCD1 == adcp) {
  69. }
  70. #endif
  71. }
  72. /* Configures the peripheral.*/
  73. }
  74. /**
  75. * @brief Deactivates the ADC peripheral.
  76. *
  77. * @param[in] adcp pointer to the @p ADCDriver object
  78. *
  79. * @notapi
  80. */
  81. void adc_lld_stop(ADCDriver *adcp) {
  82. if (adcp->state == ADC_READY) {
  83. /* Resets the peripheral.*/
  84. /* Disables the peripheral.*/
  85. #if PLATFORM_ADC_USE_ADC1 == TRUE
  86. if (&ADCD1 == adcp) {
  87. }
  88. #endif
  89. }
  90. }
  91. /**
  92. * @brief Starts an ADC conversion.
  93. *
  94. * @param[in] adcp pointer to the @p ADCDriver object
  95. *
  96. * @notapi
  97. */
  98. void adc_lld_start_conversion(ADCDriver *adcp) {
  99. (void)adcp;
  100. }
  101. /**
  102. * @brief Stops an ongoing conversion.
  103. *
  104. * @param[in] adcp pointer to the @p ADCDriver object
  105. *
  106. * @notapi
  107. */
  108. void adc_lld_stop_conversion(ADCDriver *adcp) {
  109. (void)adcp;
  110. }
  111. #endif /* HAL_USE_ADC == TRUE */
  112. /** @} */