The CPP library for STM32F4 users, libtwlab_stm32f4.a, is composed of five areas including the root area. In this post, we will explain the header files included in each folder and provide detailed descriptions of the basic functions provided in each file.


폴더 구성

libtwlab_stm32f4.a is composed of four folders: twarelabType.h file and BaseClass/, Common/, ExtendedClass/, UBoot/.


This header file is the top-level header file of the library, which includes various Define declarations and structure declarations for ease of use that are used globally throughout the library, as well as enum declarations.


The BaseClass folder contains Peripheral Classes that encapsulate the control of each peripheral.

Peripheral 지원 Class

The currently supported peripherals are ADC, GPIO, I2C, SPI, Timer, and UART, each of which is encapsulated as BaseADC, BaseGPIO, BaseI2C, BaseSPI, BaseTimer, and BaseUART, respectively.

Class Name Description STMLibrary
BaseGPIO It contains variables and member functions for controlling GPIO. LL Driver Base
BaseTimer A class for processing elapsed time by linking it with a Timer interrupt. LL Driver Base
BaseUART The class for UART control is based on DMA operation LL Driver Base
BaseADC The ADC class is used for controlling the ADC (analog-to-digital converter) peripheral. It allows for extracting 12-bit ADC values and their corresponding voltage values LL Driver Base
BaseI2C The class for controlling I2C, currently tailored for reading and writing to EEPROM HAL Driver Base
BaseSPI The class for controlling SPI is implemented based on DMA. It provides the basic functions for initializing the SPI interface, sending and receiving data using DMA, and checking the status of the interface LL Driver Base

기타 Class

Class Name Description
BaseQueue A class for managing data buffers
BaseTask The Task class is used as a management unit for processing functions
BaseCmdTask The Task class for tasks that require data parsing, such as AT commands

For more detailed explanations about member variables and member functions of each class in the libtwlab_stm32f4.a library, you can refer to the GitHub page provided in the link mentioned earlier.


Class Description
ConsoleTask The task for outputting debug messages through the console UART port
TaskManager This is a Manager class that manages the sequential execution of multiple tasks
TimerManager The Manager class manages the status of the BaseTimer objects included in each Task
FieldInfo This is a class for managing the positions and lengths of each field in the EEPROM
FlashHandler This is a class for performing operations on the Flash memory area of the MCU
crc16 A function that calculates the CRC16 value from a byte array is included
crc32 The function for calculating the CRC32 value from a byte array is included
jtag This function included in the library reads the JTAG ID value in the MCU


Class Description
BpUART BaseUART 클래스를 상속받아 UART Swap에 필요한 추가적인 기능을 제공합니다.
ATCmdTask This is a Task Class that includes the functions necessary for processing AT Commands


Class Description
STM32UBoot A Class that implements the STM32 UBoot protocol


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *