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