Getting started with TouchGFX || STM32F750

  • 28 Replies
  • 375 Views
*

Offline tha

  • *****
  • 4992
    • View Profile
Re: Getting started with TouchGFX || STM32F750
« Reply #24 on: May 25, 2023, 11:08:36 am »
เราจะใช้ the MVP design pattern เพื่อส่ง the data ไปยัง the UI. The design ถูกแสดงข้างล่าง.



•   The model อย่างใดอย่างหนึง สุ่มตัวอย่าง the data จาก the backend module, หรือรับ data นี้ผ่านทาง task อื่น.
•   The model ส่ง the data ไปยัง the presenter.
•   The presenter ส่ง data นี้ต่อไปไปยัง the view.
•   The view อัฟเดต the data บน the UI.

*

Offline tha

  • *****
  • 4992
    • View Profile
Re: Getting started with TouchGFX || STM32F750
« Reply #25 on: May 25, 2023, 11:17:58 am »
ข้างล่างคือ the presenter source file, ซึ่งจะรับ the data จาก the model.



ที่นี่ the functions setLight และ setADC ถูกเรียกโดย the modelListener. The presenter เรียก the same functions ใน the view และส่งผ่าน the data ที่รับจาก the model ไปยัง the view.

โปรดทราบว่าฟังชั่นเหล่านี้ต้องถูกกำหนดใน the presenter header files ด้วย.

*

Offline tha

  • *****
  • 4992
    • View Profile
Re: Getting started with TouchGFX || STM32F750
« Reply #26 on: May 25, 2023, 11:44:40 am »
ข้างล่างคือ the view source file.



•   The setLight function จะเซ็ต the visibility ของ the lightON image. The visibility จะเปลี่ยนขึ้นอยู่กับ the data ที่รับจาก
     the presenter.
•   หลังจากการเปลี่ยน the visibility, เราต้อง invalidate the image เพื่อให้การเปลี่ยนมีผล.
•   ก่อนอื่น The setADC function จะแปลงค่า, ที่รับจาก the presenter, ไปเป็น the characters.
•   เราจะ invalidate the textArea อีกครั้งเพื่อให้ค่าเหล่านี้ถูกแสดงบน the UI.

โปรดทราบว่าฟังชั่นเหล่านี้ต้องถูกกำหนดไว้ก่อนแล้วใน the Screen1View header file.

*

Offline tha

  • *****
  • 4992
    • View Profile
Re: Getting started with TouchGFX || STM32F750
« Reply #27 on: May 25, 2023, 11:52:56 am »
                                                                                 Result

ข้างล่างคือ the gifs ที่แสดง the results.



คุณจะเห็น the UI แสดง the Light ถูก turned on เมื่อไรก็ตามที่ the button ถูกกด.



นอกจากนี้ the ADC values กำลังอัฟเดตเมื่อ the potentiometer ถูกหมุน.

*

Offline tha

  • *****
  • 4992
    • View Profile
Re: Getting started with TouchGFX || STM32F750
« Reply #28 on: May 25, 2023, 11:54:54 am »
<a href="https://www.youtube.com/v/Y7d6-59YQu8" target="_blank" class="new_win">https://www.youtube.com/v/Y7d6-59YQu8</a>