5.2 Mixed use of low-layer APIs and HAL drivers
ในกรณีนี้ the low-layer APIs ถูกใช้ร่วมกันกับ the HAL drivers เพื่อสำเร็จ direct and register level based operations.
การใช้ผสมถูกอนุญาต, อย่างไรก็ตามบาง consideration ควรถูกคำนึงถึง:
• ขอแนะนำให้หลีกเลี่ยงการใช้ the HAL APIs และ the combination of low-layer APIs พร้อมกันสำหรับ a given peripheral
instance. หากเป็นกรณีนี้, private fields อย่างน้อยหนึ่งใน the HAL PPP handle structure ควรถูกอัฟเดตสอดคล้องกัน.
• สำหรับ operations and processes ที่ไม่เปลี่ยนแปลง the handle fields รวมถึง the initialization structure, the HAL
driver APIs and the low-layer services สามารถถูกใช้ด้วยกันได้สำหรับ the same peripheral instance.
• The low-layer drivers สามารถถูกใช้โดยไม่มีข้อจำกัดใดๆพร้อมกันกับทุก the HAL drivers ที่ไม่ขึ้นอยู่ handle objects (RCC,
common HAL, flash and GPIO).
หลายตัวอย่างแสดงวิธีใช้ HAL and LL ใน the same application ถูกจัดให้มีภายใน stm32f1 firmware package (ดูที่ Examples_MIX projects).
Note: 1. เมื่อ the HAL Init/DeInit APIs ไม่ถูกใช้และถูกแทนที่ด้วย the low-layer macros, the InitMsp() functions ไม่ถูก
เรียกและ the MSP initialization ควรถูกทำใน the user application.
2. เมื่อ process APIs ไม่ถูกใช้และ the corresponding function ถูกดำเนินการผ่านทาง the low-layer APIs, the
callbacks ไม่ถูกเรียกและ post processing หรือ error management ควรถูกทำโดย the user application.
3. เมื่อ the LL APIs ถูกใช้สำหรับ process operations, the IRQ handler HAL APIs ไม่สามารถถูกเรียกและ the IRQ
ควรถูกจัดให้มีใช้โดย the user application. แต่ละ LL driver จัดให้มีใช้ the macros ที่จำเป็นต้องอ่านและเคลียร์ the
associated interrupt flags.