As shown in the order from left to right, write:
--------------------------------------------------------------------------------------------------------------- -----------------
The header of the common HAL driver file (stm32f1xx_hal.h) includes the common
Configurations for the whole HAL library. It is the only header file, is included in the user
Sources and the HAL C sources files to beable to use the HAL.
Stm32f1xx_hal.h
Thisfile contains all of the functions prototypes for the HAL module driver.
This contains all the drivers for the HAL model
Defines the macro functions used for debugging
#define__HAL_DBGMCU_FREEZE_TIM2 ()
Set_bit (Dbgmcu->cr,dbgmcu_cr_dbg_tim2_stop)
The initialization and function function of HAL
Hal_delay ();
Header file It contains: #include "stm32f1xx_hal_conf.h"
--------------------------------------------------------------------------------------------------------------- -----------------
Stm32f1xx_hal_conf.h
Contains the peripheral model header file module that the user may use Selection
#include "stm32f1xx_hal_rcc.h"
The crystal oscillator frequency oscillator Values adaptation of single chip microcomputer are defined.
#defineHSE_VALUE ((uint32_t) 8000000)
Systems Configuration System Configuration
#define Vdd_value ((uint32_t) 3300)/*!<value of VDD in MV * *
Definition of assert parameter check function
#define ASSERT_PARAM (expr)? (void) 0:assert_failed ((uint8_t *) __file__, __line__))
It contains header files: Various peripherals model header files, such as stm32f1xx_hal_adc.h and a bunch.
--------------------------------------------------------------------------------------------------------------- -----------------
Stm32f1xx_hal_adc.h (Give ADC this peripheral header file)
Corresponding to the stm32f1xx_hal_adc_ex.h, is its corresponding extension of the function of the header file, almost ~
The peripheral initialization structure is defined, and a bunch of other structures are used for configuration.
Adc_inittypedef
Common Constants exported Constants
#defineHAL_ADC_ERROR_NONE ((uint32_t) 0x00)/*!< NoError
Macro function definition exported macro
#defin__HAL_ADC_ENABLE (__handle__) \
(Set_bit ((__handle__)->instance->cr2, (Adc_cr2_adon))
declarations for various output functions
Hal_statustypedef hal_adc_init (adc_handletypedef* HADC);
The header file it contains:
"Stm32f1xx_hal_def.h"
"Stm32f1xx_hal_adc_ex.h"
--------------------------------------------------------------------------------------------------------------- -----------------
Stm32f1xx_hal_def.h
Thisfile contains HAL common defines, enumeration, macros and structures definitions.
This file contains a common macro definition for the HAL Library, a structure, a pastoral, and so on.
The state structure of the HAL:
Hal_statustypedef
The header file it contains:
#include "stm32f1xx.h"
#include "Legacy/stm32_hal_legacy.h"
--------------------------------------------------------------------------------------------------------------- -----------------
The Stm32f103xe.h (example of F103) contains the configuration shared by the entire library, which is the only header file that all peripherals and user functions need to include in the header file.
It defines:
All peripheral registers Adc_typedef (struct),
All interrupted numbers Irqn_type (enum),
The address of the peripheral,
#define Flash_base ((uint32_t) 0x08000000)
Macro functions for checking parameters
#define Is_adc_all_instance (INSTANCE) ((INSTANCE) = = ADC1) | |
((INSTANCE) = = ADC2) | | \
((INSTANCE) = = ADC3))
Peripheral Interrupt Function Name
#define ADC1_IRQN ADC1_2_IRQN
The header files it contains include:
#include "core_cm3.h" M3 kernel files
#include the system initialization of "system_stm32f1xx.h" monolithic microcomputer
#include <stdint.h> statement on int ~
--------------------------------------------------------------------------------------------------------------- -----------------
The header file's inclusion relationship is exactly the same as the diagram, and according to this relationship, when using the cube to configure or change peripherals, stm32f1xx_hal_conf.h changes and increases and decreases the number of peripheral headers, which causes most files to be recompiled for a long time ...
With the generated dac.c/.h this file example,. h has generated an extern dac_handletypedef HDAC that provides an interface to an external file that can be used directly with HDAC as long as it contains dac.h.
Cube project generated in the settings, there is an option for whether to delete the user peripherals. C/.h, note that the code you write may be deleted .... In terms of the accumulation of the program, I prefer to write a file similar to mydac.c/.h, including dac.h, a little needed. (There are a number of functions that are defined as weak types, such as callback functions.)