BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Author Topic: BT816 and PIC18F46K22 with external memory (SD CARD)  (Read 53 times)

elektor18

  • Newbie
  • *
  • Posts: 2
    • View Profile
BT816 and PIC18F46K22 with external memory (SD CARD)
« on: May 14, 2019, 01:46:50 PM »

Hi all,

I'm planing to store images (bmp/jpg) on sd card and I'm wondering if that is going to be possible to display on screen using BT816 chip? or image need to be converted first and loaded to display?
Next question, dial widget. Is it possible to create custom dial (or slider)? If yes, is someone did it already maybe, maybe some examples? 

Thanks in advance.
Logged

BRT Community

  • Administrator
  • Newbie
  • *****
  • Posts: 36
    • View Profile
Re: BT816 and PIC18F46K22 with external memory (SD CARD)
« Reply #1 on: May 15, 2019, 11:00:20 AM »

Hello,

Please see section 7 of the following application note, it covers the methods available for loading images to display:
https://brtchip.com/wp-content/uploads/Support/Documentation/Application_Notes/ICs/EVE/BRT_AN_014_FT81X_Simple_PIC_Library_Examples.pdf

Predominantly the image will need to be converted to be used, but it is possible to directly load some .png images.

Yes, it is possible to create your own custom widgets.

Best Regards,
BRT Community
Logged

Rudolph

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: BT816 and PIC18F46K22 with external memory (SD CARD)
« Reply #2 on: May 15, 2019, 07:00:58 PM »

>Next question, dial widget. Is it possible to create custom dial (or slider)?

First, what it looks like.
When you use a CMD_DIAL() in the EVE Screen Editor and check the "Inspector" tab you will see this:

   Raw   Text
1   0x22000000   SAVE_CONTEXT()
2   0x27000002   VERTEX_FORMAT(2)
3   0x0d000240   POINT_SIZE(576)
4   0x1f000002   BEGIN(POINTS)
5   0x04ffffff   COLOR_RGB(255, 255, 255)
6   0x412d02d2   VERTEX2F(602, 722)
7   0x04000000   COLOR_RGB(0, 0, 0)
8   0x413002d8   VERTEX2F(608, 728)
9   0x04003870   COLOR_RGB(0, 56, 112)
10   0x412e02d4   VERTEX2F(604, 724)
11   0x1f000003   BEGIN(LINES)
12   0x04000000   COLOR_RGB(0, 0, 0)
13   0x0e00001b   LINE_WIDTH(27)
14   0x41168311   VERTEX2F(557, 785)
15   0x410b8333   VERTEX2F(535, 819)
16   0x23000000   RESTORE_CONTEXT()
17   0x22000000   SAVE_CONTEXT()
18   0x27000002   VERTEX_FORMAT(2)
19   0x0e00001b   LINE_WIDTH(27)
20   0x41180314   VERTEX2F(560, 788)
21   0x410d0336   VERTEX2F(538, 822)
22   0x23000000   RESTORE_CONTEXT()

So what is displayed for a dial is three overlapping points and two overlapping lines.
Along with some redundant code I have to say, now that I see this.

What makes this a widget is that the co-processor calculates the position of the line to a given angle.
Also there is the "flat" option which reduces the amount of points to be drawn to one.

This can be easily replaced with a picure of a knob or a steering-wheel, or a triangle, or a parrot or whatever.
You can tell EVE to rotate images.


Now the tricky part is to make your dial or slider behave like a dial or a slider.
The widgets do not do this by themselves, much like a button will not automatically display itself as pressed.
Key to this is CMD_TRACK.

With for example
EVE_cmd_track(center-x,center-x,1,1,touch-tag);

You activate touch-tracking for a single object and tell EVE you want the result as angle.

This is the angle you can either call the dial widget with or by which you tell EVE to rotate your image.
The result can be found in REG_TRACKER.

Oh yes, it helps when you combine this with touch detection itself.
Only activate touch-tracking for an object when you detected a touch-event for it and disable tracking
when the object no longer is touched.
And REG_TRACKER also returns the touch-tag for verification.

I recently played with this myself in order to implement a steering wheel.
One of the problems I had was the winkel returned is absolute.

When you touch on any point around the given center the angle you get in return is for that point.
Now imagine the steering wheel in your car and what will happen when you tab it on the upper left and the bottom
rotates directly over to upper left. :-)
Or the knob on your stereo, it also will not switch between zero and max when you tab it on the lower left and  lower right.

I solved that by reading the initial value right after starting tracking and when my programm checks again for a touch-event
it calculates the difference from that initial point to the current point and only adds this difference to the angle of my steering wheel.

What I find a bit difficult is the numeric representation of the angle.
It is in 1/65535 with bottom center at zero.

What I have not figured out completely yet is how to limit the movement to +/- 40° for example.
Logged

elektor18

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: BT816 and PIC18F46K22 with external memory (SD CARD)
« Reply #3 on: May 17, 2019, 09:20:55 AM »

Hello again,


Predominantly the image will need to be converted to be used, but it is possible to directly load some .png images.

Best Regards,
BRT Community
Could you give maybe some more details how to do that, please?

Rudolph, thank you for this information, now I need to "digest" it and try to play with it  ;D
Logged