1
2
ARM Processors / Re: Getting started with TouchGFX || STM32F750
« Last post by tha on June 01, 2023, 09:47:25 am » Result
ข้างล่าง the gif แสดง the animated image และ the gauge working

ข้างล่าง the gif แสดง the animated image และ the gauge working

3
ARM Processors / Re: Getting started with TouchGFX || STM32F750
« Last post by tha on June 01, 2023, 09:40:07 am »

ใน the view source file สุดท้ายเราจะเขียน the functions เพื่อแสดง the data บน the UI.
• ใน the setADC function, เราจะเซ็ตค่า (ที่รับจาก the presenter) ให้กับ the Gauge.
• จากนั้น invalidate the gauge เพื่อให้การอัฟเดตมีผล.
ใน the setAnimation function ก่อนอื่นเราจะเช็คว่า the animation กำลังรันอยู่หรือไม่.
• ถ้า the animation ไม่ได้รันอยู่, และ the state เป็น true (button ถูกกด), ดังนั้นเราจะสตาร์ท the animation.
• startAnimation ใช้พารามิเตอร์ต่อไปนี้
• @rev กำหนดว่า the animation ควรถูกทำในลำดับย้อนกลับหรือไม่. ฉันได้เซ็ตมันเป็น false
• @reset กำหนดว่า the animation ควรรีเซ็ตและสตาร์ทจากบิตแมปแรก (หรือสุดท้ายหากเรียงลำดับย้อนกลับ). มันถูกเซ็ตเป็น
false เนื่องจากฉันไม่ต้องการให้ the animation รีเซ็ตเมื่อไรก็ตามที่ the button ถูกกด.
• @loop กำหนดว่า the animation ควรวนลูปหรือทำ a single animation. มันถูกเซ็ตเป็น true เนื่องจากฉันต้องการให้ the
animation คงการวนลูปเมื่อ the button ถูกกด.
• ถ้า the animation กำลังรันอยู่และ the button ถูกปล่อย, เราจะหยุดค้าง the animation ชั่วคราว.
• The function pauseAnimation() ถูกใช้เพือหยุดค้าง the animation ชั่วคราว.
4
ARM Processors / Re: Getting started with TouchGFX || STM32F750
« Last post by tha on June 01, 2023, 08:39:19 am »
ใน the presenter source file, เราจะเรียก the same functions ใน the view.
5
ARM Processors / Re: Getting started with TouchGFX || STM32F750
« Last post by tha on May 31, 2023, 10:34:15 am »

ที่นี่เราจะ include the RTOS header file และ the main header file ก่อน. เราจำเป็นต้อง define the queues ภายนอกด้วย.
• ตอนนี้ใน the tick function ก่อนอื่นเราจะรับค่าจาก the adc queue, และเก็บมันใน the ADC_value variable.
• The modelListener จะเรียก the function setADC ใน the presenter และส่ง the ADC_value เป็น the parameter ให้กับ
ฟังชั่นนี้.
• ในทำนองเดียวกันเราจะรับ the button state จาก the button queue และเก็บมันในตัวแปร Button_State.
• อีกครั้ง the modelListener จะเรียก the function setAnimation ใน the presenter และส่ง the button state เป็น the
parameter ของฟังชั่นนี้.
6
ARM Processors / Re: Getting started with TouchGFX || STM32F750
« Last post by tha on May 31, 2023, 10:06:34 am »
ใน the model header file ฉันได้กำหนดตัวแปร ADC_value และ Button_State.
7
ARM Processors / Re: Getting started with TouchGFX || STM32F750
« Last post by tha on May 31, 2023, 10:01:16 am »
ใน the ADC task เราอ่าน the ADC data ง่ายๆและแม็ปมันให้เป็นค่าระหว่าง 0 ถึง 100.
จากนั้นค่าที่ถูกแม็ปจะถูกส่งไปยัง the adc queue.
8
ARM Processors / Re: Getting started with TouchGFX || STM32F750
« Last post by tha on May 31, 2023, 08:46:54 am » Some Insight into the CODE

ฉันได้สร้าง the Button_State variable เพื่อเก็บ the button state. The ADC_Value และ the converted_val จะถูกใช้เพื่อเก็บ the RAW ADC value และ the converted value (ย่าน 0 – 100).
The map function ถูกใช้เพื่อแปลง the RAW ADC values ไปเป็นย่านที่เราต้องการ (ในกรณีนี้ 0-100).

• ที่นี่เราจะอ่าน the pin PI11 และเก็บค่าของมันไปยัง the Button_State variable.
• จากนั้นส่งค่าของตัวแปรไปยัง the queue.
• 2 พารามิเตอร์สุดท้ายใน the osMessageQueuePut คือ the message priority และ the timeout.
• ฉันได้คง the priority ไว้ที่ต่ำสุด (0), และ the timeout เป็น 0 หมายถึง the message จะถูกใส่ไปยัง the queue เฉพาะถ้ามีที่ว่าง
ให้ใช้งานใน the queue.
• The function จะไม่รอสำหรับ the space มีให้ใช้งาน.
• The button task จะรันทุกๆ 5ms.

ฉันได้สร้าง the Button_State variable เพื่อเก็บ the button state. The ADC_Value และ the converted_val จะถูกใช้เพื่อเก็บ the RAW ADC value และ the converted value (ย่าน 0 – 100).
The map function ถูกใช้เพื่อแปลง the RAW ADC values ไปเป็นย่านที่เราต้องการ (ในกรณีนี้ 0-100).

• ที่นี่เราจะอ่าน the pin PI11 และเก็บค่าของมันไปยัง the Button_State variable.
• จากนั้นส่งค่าของตัวแปรไปยัง the queue.
• 2 พารามิเตอร์สุดท้ายใน the osMessageQueuePut คือ the message priority และ the timeout.
• ฉันได้คง the priority ไว้ที่ต่ำสุด (0), และ the timeout เป็น 0 หมายถึง the message จะถูกใส่ไปยัง the queue เฉพาะถ้ามีที่ว่าง
ให้ใช้งานใน the queue.
• The function จะไม่รอสำหรับ the space มีให้ใช้งาน.
• The button task จะรันทุกๆ 5ms.
9
ARM Processors / Re: Getting started with TouchGFX || STM32F750
« Last post by tha on May 31, 2023, 07:30:26 am »
ฉันได้สร้าง 2 queues สำหรับ the inter task messaging ด้วย. พวกมันจะถูกใช้เพื่อส่ง the data ไปยัง the GUI task.
The adcqueue มี 10 items ของ 16 bit data size. พวกมันจะถูกใช้เพื่อเก็บ the ADC values.
The buttonqueue มี 2 items ของ 8 bit data size.
10
ARM Processors / Re: Getting started with TouchGFX || STM32F750
« Last post by tha on May 31, 2023, 07:23:30 am »
ฉันได้สร้าง task ใหม่ขึ้น 2 tasks สำหรับ the ADC และ the button. ทั้งสอง the tasks มี the low priority.