stm32f1_hal_lowlevel.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /* This file combines several STM32F1 HAL Functions into one file. This was done
  2. for space reasons, to avoid having several MB of HAL functions that most people
  3. will not use. In addition this HAL is slightly less demanding (no interrupts),
  4. but less robust as doesn't implement the timeouts.
  5. The original HAL files are COPYRIGHT STMicroelectronics, as shown below:
  6. */
  7. /*
  8. * COPYRIGHT(c) 2017 STMicroelectronics
  9. *
  10. * Redistribution and use in source and binary forms, with or without modification,
  11. * are permitted provided that the following conditions are met:
  12. * 1. Redistributions of source code must retain the above copyright notice,
  13. * this list of conditions and the following disclaimer.
  14. * 2. Redistributions in binary form must reproduce the above copyright notice,
  15. * this list of conditions and the following disclaimer in the documentation
  16. * and/or other materials provided with the distribution.
  17. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  18. * may be used to endorse or promote products derived from this software
  19. * without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  22. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  24. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  25. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  27. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  28. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  29. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. *
  32. ******************************************************************************
  33. */
  34. #ifndef STM32F1_HAL_LOWLEVEL_H
  35. #define STM32F1_HAL_LOWLEVEL_H
  36. /* ########################## HSE/HSI Values adaptation ##################### */
  37. /**
  38. * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
  39. * This value is used by the RCC HAL module to compute the system frequency
  40. * (when HSE is used as system clock source, directly or through the PLL).
  41. */
  42. #if !defined (HSE_VALUE)
  43. #define HSE_VALUE (7384600U) /*!< Value of the External oscillator in Hz */
  44. #endif /* HSE_VALUE */
  45. #if !defined (HSE_STARTUP_TIMEOUT)
  46. #define HSE_STARTUP_TIMEOUT (100U) /*!< Time out for HSE start up, in ms */
  47. #endif /* HSE_STARTUP_TIMEOUT */
  48. /**
  49. * @brief Internal High Speed oscillator (HSI) value.
  50. * This value is used by the RCC HAL module to compute the system frequency
  51. * (when HSI is used as system clock source, directly or through the PLL).
  52. */
  53. #if !defined (HSI_VALUE)
  54. #define HSI_VALUE (16000000U) /*!< Value of the Internal oscillator in Hz*/
  55. #endif /* HSI_VALUE */
  56. /**
  57. * @brief Internal Low Speed oscillator (LSI) value.
  58. */
  59. //#if !defined (LSI_VALUE)
  60. // #define LSI_VALUE (32000U)
  61. //#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
  62. // The real value may vary depending on the variations
  63. // in voltage and temperature. */
  64. /**
  65. * @brief External Low Speed oscillator (LSE) value.
  66. */
  67. #if !defined (LSE_VALUE)
  68. #define LSE_VALUE (32768U) /*!< Value of the External Low Speed oscillator in Hz */
  69. #endif /* LSE_VALUE */
  70. #if !defined (LSE_STARTUP_TIMEOUT)
  71. #define LSE_STARTUP_TIMEOUT (5000U) /*!< Time out for LSE start up, in ms */
  72. #endif /* LSE_STARTUP_TIMEOUT */
  73. /**
  74. * @brief External clock source for I2S peripheral
  75. * This value is used by the I2S HAL module to compute the I2S clock source
  76. * frequency, this source is inserted directly through I2S_CKIN pad.
  77. */
  78. #if !defined (EXTERNAL_CLOCK_VALUE)
  79. #define EXTERNAL_CLOCK_VALUE (12288000U) /*!< Value of the External oscillator in Hz*/
  80. #endif /* EXTERNAL_CLOCK_VALUE */
  81. /* Tip: To avoid modifying this file each time you need to use different HSE,
  82. === you can define the HSE value in your toolchain compiler preprocessor. */
  83. /* ########################### System Configuration ######################### */
  84. /**
  85. * @brief This is the HAL system configuration section
  86. */
  87. #define VDD_VALUE (3300U) /*!< Value of VDD in mv */
  88. #define TICK_INT_PRIORITY (0x0FU) /*!< tick interrupt priority */
  89. #define USE_RTOS 0U
  90. #define PREFETCH_ENABLE 0U /* The prefetch will be enabled in SystemClock_Config(), depending on the used
  91. STM32F405/415/07/417 device: RevA (prefetch must be off) or RevZ (prefetch can be on/off) */
  92. #define INSTRUCTION_CACHE_ENABLE 1U
  93. #define DATA_CACHE_ENABLE 1U
  94. //#define STM32F100xB
  95. #include "stm32f1xx.h"
  96. #endif