MT7687 API Reference
LinkIt SDK v4
|
This section introduces the HAL driver APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, HAL function groups, enums, structures and functions. More...
This section introduces the HAL driver APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, HAL function groups, enums, structures and functions.
Acronyms | Definition |
---|---|
ACCDET | Accessory detector |
ADC | Analog-to-digital converter |
AES | Advanced Encryption Standard |
CMSIS | Cortex Microcontroller Software Interface Standard |
CTP | Capacitive Touch Panel |
EINT | External interrupt |
GDMA | General direct memory access |
GPC | General purpose counter |
GPIO | General purpose Input Output |
GPT | General purpose timer |
I2C | Inter-integrated circuit |
I2S | Inter-integrated sound |
LCD | Liquid Crystal Display |
LCM | LCD Module |
MD5 | Message-Digest Algorithm |
MPU | Memory protect unit |
PWM | Pulse Width Modulation |
RTC | Real-time clock |
SD | Secure Digital Memory Card |
SDIO | Secure Digital Input and Output |
SHA | Secure Hash Algorithm |
SPI | Serial Peripheral Interface |
UART | Universal asynchronous receiver/transmitter |
USB | Universal Serial Bus |
WDT | Watchdog timer |
TRNG | True random number generator |
naming convention | |
---|---|
function names | hal_{feature}_{sub_feature}(), such as hal_uart_init() |
enum names | Type name:hal_{feature}_{sub_feature}_t, such as hal_uart_baudrate_t. Enum member names:HAL_{FEATURE}_{SUB_FEATURE}, such as HAL_UART_BAUDRATE_110. |
struct name | Type name:hal_{feature}_{sub_feature}_t,such as hal_uart_config_t. Struct member names must be lowercase. |
macro names | HAL_{FEATURE}_{SUB_FEATURE}, such as HAL_NVIC_QUERY_EXCEPTION_NUMBER |
function pointer names | hal_{feature}_{sub_feature}_t(), such as void (*hal_uart_callback_t)(). |
Some of the drivers can operate in two modes: polling and interrupt. The UART HAL driver, for example, can operate in polling and interrupt modes during data communication. The polling mode is suitable for read and write operations of small amount of data in low frequency. The interrupt mode is suitable for read and write operations of small amount of data in high frequency. In UART DMA mode, for example, an interrupt is triggered once the DMA is complete.
Interrupt mode architecture
To improve the portability, the HAL driver hides the OS dependence by preventing the upper layer to call the OS level services directly. The HAL drivers uses an interrupt handler to provide the upper layer with a callback mechanism.
To use the interrupt handler of a driver module, a callback should be registered with the interrupt handler. When the interrupt occurs, the callback is invoked in Cortex-M4 handler mode. Call the hal_uart_send_dma() API to send data in the UART interrupt mode (UART DMA mode). The UART HAL driver will copy the data to DMA buffer and start the DMA operation while the DMA sends data to the UART hardware. When the DMA operation completes, the DMA interrupt is issued. The UART HAL driver will invoke the user callback in interrupt handler to notify that the data has been sent out by the UART. Another example of the interrupt is the GPT interrupt mode. Call the hal_gpt_start_timer_ms() API to start a timer. When the timer expires, the GPT hardware issues an interrupt. Then the GPT HAL driver will invoke the user callback in interrupt handler to notify that the timer has expired. The interrupt mode driver architecture is shown below:
All HAL APIs are thread-safe and available for ISR. Developers may call HAL APIs in any FreeRTOS task or in an ISR.
However, some hardware have limited resources, and the corresponding APIs return "ERROR_BUSY" status when there is a resource conflict due to the re-entrance. Developers should always check the return values from HAL APIs.
For example, I2C master supports only one user at a time, so hal_i2c_master_init() returns HAL_I2C_STATUS_ERROR_BUSY when another user is using I2C master.
Variables | |
uint8_t | rtc_sec |
Seconds after minutes - [0,59]. | |
uint8_t | rtc_min |
Minutes after the hour - [0,59]. | |
uint8_t | rtc_hour |
Hours after midnight - [0,23]. | |
uint8_t | rtc_day |
Day of the month - [1,31]. | |
uint8_t | rtc_mon |
Months - [1,12]. | |
uint8_t | rtc_week |
Days in a week - [0,6]. | |
uint8_t | rtc_year |
Years - [0,99]. | |
Modules | |
ADC | |
This section describes the programming interfaces of the Analog-to-Digital Converter (ADC) HAL driver. | |
AES | |
This section introduces the AES driver APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, AES function groups, enums, structures and functions. | |
CACHE | |
This section describes the programming interfaces of the CACHE controller. | |
DES | |
This section introduces the DES driver APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, DES function groups, enums, structures and functions. | |
EINT | |
This section introduces the External Interrupt Controller(EINT) APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, EINT function groups, enums, structures and functions. | |
FLASH | |
This section describes the programming interfaces of the FLASH driver. | |
GDMA | |
This section introduces the General Direct Memeory Access(GDMA) APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, GDMA function groups, enums, structures and functions. | |
GPC | |
This section introduces the General Purpose Counter(GPC) APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, GPC function groups, enums, structures and functions. | |
GPIO | |
This section provides introduction to the General Purpose Input Output (GPIO) APIs, including terms and acronyms, features, architecture, how to use APIs, the GPIO function groups, enums, structures and functions. | |
GPT | |
This section introduces the General Purpose Timer(GPT) driver APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, GPT function groups, enums, structures and functions. | |
I2C_MASTER | |
I2S | |
This section introduces the I2S APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, I2S function groups, enums, structures and functions. | |
IRRX | |
This section introduces the Infrared Receiver(IRRX) APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, IRRX function groups, enums, structures and functions. | |
IRTX | |
This section introduces the Infrared Transmitter(IRTX) APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, IRTX function groups, enums, structures and functions. | |
MD5 | |
This section introduces the MD5 driver APIs including terms and acronyms, supported features, software architecture, details on how to use this driver. | |
NVIC | |
This section introduces the Nested Vectored Interrupt Controller(NVIC) HAL APIs including terms and acronyms, details on how to use this driver, supported features, enums, structures and functions. | |
PWM | |
This section introduces the Pulse-Width Modulation(PWM) APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, PWM function groups, enums, structures and functions. | |
RTC | |
This section introduces the Real-Time Clock (RTC) APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, enums, structures and functions. | |
SHA | |
This section introduces the SHA driver APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, SHA function groups, enums, structures and functions. | |
SLEEP_MANAGER | |
This section introduces the Sleep Manager driver APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, Sleep Manager function groups, enums, structures and functions. | |
SPI_MASTER | |
This section introduces the Serial Peripheral Interface Master (SPI_Master) APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, enums, structures and functions. | |
SPI_SLAVE | |
This section introduces the SPI Slave APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, enums, structures and functions. | |
TRNG | |
This section introduces the True Randam Number Generator(TRNG) APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, TRNG function groups, enums, structures and functions. | |
UART | |
This section introduces the Universal Asynchronous Receiver/Transmitter (UART) APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, UART function groups, enums, structures and functions. | |
WDT | |
This section introduces the Watchdog Timer (WDT) APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, enums, structures and functions. | |