3.2 HAL data structuresแต่ละ HAL driver สามารถบรรจุ the following data structures:
• Peripheral handle structures
• Initialization and configuration structures
• Specific process structures.
3.2.1 Peripheral handle structuresThe APIs มี a modular generic multi-instance architecture ที่ยอมให้การทำงานกับ several IP instances พร้อมกัน.
PPP_HandleTypeDef *handle เป็น the main structure ที่ถูกจัดให้มีใช้ใน the HAL drivers. มันจัดการ the peripheral/module configuration and registers และฝังทุก the structures and variables ที่จำเป็นต้องตามติด the peripheral device flow.
The peripheral handle ถูกใช้สำหรับจุดมุ่งหมายต่อไปนี้:
• Multi-instance support: แต่ละ peripheral/module instance มี handle ของตัวเอง. ด้วยเหตุนี้ instance resources จึงเป็น
อิสระ.
• Peripheral process intercommunication: the handle ถูกใช้เพื่อจัดการ shared data resources ระหว่าง the process
routines.
Example: global pointers, DMA handles, state machine.
• Storage : handle นี้ถูกใช้เพื่อจัดการ global variables ภายใน a given HAL driver ด้วย.
ตัวอย่างของ peripheral structure ถูกแสดงไว้ข้างล่าง:
