6 HAL System Driver

Started by tha, June 25, 2022, 06:46:24 AM

Previous topic - Next topic

tha

6   HAL System Driver

6.1   HAL Firmware driver API description

section ต่อไปนี้แสดงรายการ the various functions of the HAL library.

6.1.1   How to use this driver
The common HAL driver บรรจุ a set of generic and common APIs ที่สามารถถูกใช้โดย the PPP peripheral drivers และ the user เพื่อสตาร์ทการใช้ the HAL.
The HAL บรรจุ two APIs' categories:
•   Common HAL APIs
•   Services HAL APIs

tha

6.1.2 Initialization and de-initialization functions

ส่วนนี้จัดให้มีฟังก์ชันที่ช่วยให้:
•   กำหนดค่าเริ่มต้น the Flash interface, the NVIC allocation และกำหนดค่าเริ่มต้น clock configuration. มันกำหนดค่าเริ่มต้น the
     systick ด้วยเมื่อ timeout ถูกต้องการและ the backup domain เมื่อถูกเปิดใช้งาน.
•   ยกเลิกการกำหนดค่าเริ่มต้น common part of the HAL.
•   กำหนดค่า The time base source ให้มี 1ms time base ด้วย a dedicated Tick interrupt priority.
    –   SysTick timer ถูกใช้โดยเริ่มต้นเป็น source of time base, แต่ในที่สุดผู้ใช้สามารถจัดให้มีใช้ time base source ที่เหมาะสม
         ของเขา(ตัวอย่างเช่น a general purpose timer หรือ time source อื่นๆ), โดยคำนึงถึงว่า Time base duration ควรเป็น 1ms
         เนื่องจาก PPP_TIMEOUT_VALUEs ถูกกำหนดและถูกจัดการใน milliseconds basis.
    –   Time base configuration function (HAL_InitTick ()) ถูกเรียกโดยอัตโนมัติที่ the beginning of the program หลังจาก
         reset โดย HAL_Init() หรือที่เวลาใดๆเมื่อ clock ถูกกำหนดค่า, โดย HAL_RCC_ClockConfig().
    –   Source of time base ถูกกำหนดค่าเพื่อสร้าง interrupts ในคาบเวลาที่คงที่. ต้องใช้ความระมัดระวัง ถ้า HAL_Delay() ถูกเรียก
         จาก a peripheral ISR process, the Tick interrupt line ต้องมี priority (ตัวเลขน้อยกว่า) สูงกว่า the peripheral
         interrupt. มิฉะนั้น the caller ISR process จะถูกบล็อก.
    –   functions ที่ส่งผลต่อ time base configurations ถูกประกาศเป็น __weak เพื่อให้การแทนที่เป็นไปได้ในกรณีของการจัดให้มีใช้
         งานอื่น ๆ ใน user file.

This section บรรจุ the following APIs:
•   HAL_Init
•   HAL_DeInit
•   HAL_MspInit
•   HAL_MspDeInit
•   HAL_InitTick

tha

6.1.3 HAL Control functions
ส่วนนี้จัดให้มีฟังก์ชันที่ช่วยให้:
•   Provide a tick value in millisecond
•   Provide a blocking delay in millisecond
•   Suspend the time base source interrupt
•   Resume the time base source interrupt
•   Get the HAL API driver version
•   Get the device identifier
•   Get the device revision identifier
•   Enable/Disable Debug module during SLEEP mode
•   Enable/Disable Debug module during STOP mode
•   Enable/Disable Debug module during STANDBY mode


tha

ส่วนนี้บรรจุ the following APIs:
•   HAL_IncTick
•   HAL_GetTick
•   HAL_GetTickPrio
•   HAL_SetTickFreq
•   HAL_GetTickFreq
•   HAL_Delay
•   HAL_SuspendTick
•   HAL_ResumeTick
•   HAL_GetHalVersion
•   HAL_GetREVID
•   HAL_GetDEVID
•   HAL_GetUIDw0
•   HAL_GetUIDw1
•   HAL_GetUIDw2
•   HAL_DBGMCU_EnableDBGSleepMode
•   HAL_DBGMCU_DisableDBGSleepMode
•   HAL_DBGMCU_EnableDBGStopMode
•   HAL_DBGMCU_DisableDBGStopMode
•   HAL_DBGMCU_EnableDBGStandbyMode
•   HAL_DBGMCU_DisableDBGStandbyMode

tha

6.1.4 Detailed description of functions

          HAL_Init
Function name
          HAL_StatusTypeDef HAL_Init (void )
Function description
          This function ถูกใช้เพื่อกำหนดค่าเริ่มต้น the HAL Library; มันต้องเป็น the first instruction ที่จะถูกปฏิบัติใน the main
          program (ก่อนที่จะเรียก HAL function อื่นใดๆ), มันดำเนินการต่อไปนี้: กำหนดค่า the Flash prefetch.
Return values
          •   HAL: status
Notes
          •   SysTick ถูกใช้เป็น time base สำหรับ the HAL_Delay() function, the application จำเป็นต้องแน่ใจว่า the SysTick
               time base ถูกเซ็ตเป็น 1 millisecond เสมอเพื่อให้มี correct HAL operation.

tha

          HAL_DeInit
Function name
          HAL_StatusTypeDef HAL_DeInit (void )
Function description
           ฟังชั่นนี้ยกเลิกการกำหนดค่าเริ่มต้น common part of the HAL และหยุด the systick.
Return values
          •   HAL: status
Notes
          •  ฟังชั่นนี้เป็นทางเลือก.

tha


tha