Skip to main content
HTD
Senior II
May 24, 2022
Question

Where can I find some naming conventions for HAL related drivers?

  • May 24, 2022
  • 3 replies
  • 1569 views

Some HAL functions, like HAL_UART_Transmit_IT use "_IT" suffix. Is there a convention for it described anywhere? Let's say my driver also has some blocking mode and interrupt mode calls. Should I use "_IT" suffix? Or maybe "_async"? What does "_IT" even mean? Like "InterrupT"? ;)

Is such function called "asynchronous" in C? What about functions that exit immediately but call the callback when something they started is completed? Is there a special name for them, is there a special naming convention?

Should I place the callback as the last argument, or can it appear anywhere in the signature?

This topic has been closed for replies.

3 replies

Andrew Neil
Super User
May 24, 2022

Is such function called "asynchronous" in C?

The term is general - not specific to C.

Also known as "non-blocking" - as opposed to "blocking", where the code waits ("blocks") until the process is complete.

What about functions that exit immediately but call the callback when something they started is completed?

That is asynchronous (non-blocking) operation.

Should I place the callback as the last argument, or can it appear anywhere in the signature?

Parameters in C functions are identified by position; if the call back is the last parameter in the declaration, then it must also be the last in the call.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Amel NASRI
ST Technical Moderator
May 25, 2022

Hi @Adam �?yskawa​ ,

For each STM32Cube firmware package, you should find a user manual explaining the HAL & LL drivers of each STM32 product. If we take as example STM32F4, you will find UM1725 Description of STM32F4 HAL and low-layer drivers.

So here an extract from this document explaining the 3 operating modes for UART:

0693W00000NqefZQAR.png-Amel

To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.
HTD
HTDAuthor
Senior II
May 25, 2022

Thanks for directing me to the right docs, I took the harder path of digging in the HAL source code ;) This document clarifies it well enough.