STM32 knowledge Review

STM32 must be open before the operation corresponding peripheral clock, there are two general STM32 clock bus, peripherals generally a serial clock on the two buses, but use stm32cubemx to build the project, you do not open their own clock bus , stm32cubemx generated by the project will automatically open your initialization bus.

 

Wherein, HAL_Delay () function is a library HAL delay function, the unit is 1 millisecond.

 

 Universal asynchronous serial port en bloc to send data API, can be found in stm32l4xx_hal_uart.c in:

The first argument: if a port is a & huart1, then serial 2 is & huart2

The second parameter: a pointer to data to be transmitted or the data itself;

The third parameter: the length of the transmission data;

The fourth parameter: timeout;

HAL_UART_Transmit(&huart1,"love is precious for me",23,10);

 

The first argument: if a port is a & huart1, then serial 2 is & huart2

The second parameter: a pointer to the received data or the data itself;

The third parameter: the length of the receiving data;

The fourth parameter: timeout;


HAL_UART_Receive(&huart1,buffer,23,10);

Guess you like

Origin www.cnblogs.com/braveheart007/p/10973942.html