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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - MPW691

Pages: [1]
1
Hi all,

Issue has been resolved now, thanks for the info @Rudolf! This pointed me in the right direction!
Well, the interrupt might have been delayed so the event already passed when the registers are read.


It looks like something (can't work out what) was causing the Tag and Touch registers to be cleared if I did not read the value quick enough, so I ensured that the interrupt triggered a section of code to immediately read the registers and store them (was previously setting a flag and then dealing with it when available) and that resolved the issue.

Thanks for the help, this is a great community that always seems to have the answers!

2
Hello,

Thank you for the suggestion, but unfortunately it doesn't seem to have helped. ON the Resistive Engines (FT810 etc) there are registers for settle, charge, RZThreshold etc which affect when a press is detected, is there anything similar for the Capacitive engines (Ft811)? I can't see anything in the manual so I'm assuming not...

Thanks.

3
Discussion - EVE / Touch register intermittently gets correct values
« on: April 21, 2022, 03:35:57 PM »
Hi all,

I am using the FT811 chip with an LCD screen, and have set the size of the screen and other parameters. When I press on a button, it triggers an interrupt as expected, and within the function I read the tag register and press position on the screen:
Code: [Select]
void ft811_new_interrupt() {
uint8_t press_mask = ft_read8(FT_REG_INT_MASK);
uint8_t press_tag = ft_read8(FT_REG_CTOUCH_TAG);
uint32_t tag_xy    = ft_read32(FT_REG_TOUCH_TAG_XY);
uint32_t press_xy = ft_read32(FT_REG_CTOUCH_TOUCH0_XY);
uint8_t int_flags = ft_read8(FT_REG_INT_FLAGS);

Sometimes, when I press the button, I get the expected response, that looks like:

Code: [Select]
TAG:0x06
TagXY:0x023C0160
PressXY0:0x023C0160
MASK:0x06
FLAGS:0xA7

However sometimes, I press on the button, and get this:
Code: [Select]
TAG:0x0
TagXY:0x80008000
PressXY0:0x80008000
MASK:0x06
FLAGS:0xAF

But I don't understand why its intermittent. Its not a different type of press, every press generates an interrupt correctly and I am reading the values directly (and in this case immediately printing them), so why are the tag and press registers empty? Is there a setting I need to change to get this to be more reliable?

Any help would be greatly appreciated!

4
Discussion - EVE / Re: Button Press Colour
« on: November 09, 2020, 08:58:28 AM »
Makes sense, it was more for a sanity checking function to ensure the structure had been updated correctly when debugging any issues, but if it's not possible then it doesn't change anything.

Thanks for the help everyone!

5
Discussion - EVE / Re: Button Press Colour
« on: November 05, 2020, 08:24:28 AM »
I do have one further question though. Is it possible to read out what the FG and BG values are currently set to in co-processor? I know if I call a cmd_coldstart then they revert back to default values, but since I can change that value via the cmd_FG_COLOR, it might be helpful to read out the current state. Is there a specific address where that value is stored?

6
Discussion - EVE / Re: Button Press Colour
« on: November 05, 2020, 08:12:07 AM »
Hi All,

Thank you for the fast response, I didn't initially realise that the button press colour change was done within our code instead of the EVE.

The idea about using the OPT_FLAT is a good one which we already use for 3D buttons, but the buttons I am drawing are always drawn flat (in my opinion they look smarter), so colour-change is needed to signify the difference between pressed and not pressed. I went back through the code and found that when we define a button, we add the following to the display list:

Code: [Select]
#define FGCOLOR 0x003870
#define BGCOLOR 0x002040

#define GUI_BUTTON(tag,x,y,w,h,font,flat,str)                             \
{                                                \
    bool pressed = ((tag) == current_tag);           \
    uint16_t toggle_flat = (pressed ? FT_OPT_FLAT : 0);  \
    if (pressed) ft_cpcmd_fgcolor(avgcolour(FGCOLOR, BGCOLOR)); \
    ft_cpcmd(FT_DL_TAG(tag));                    \
    ft_cpcmd_button(x, y, w, h, font, (flat == 1 ? FT_OPT_FLAT : toggle_flat), str);
    if (pressed) ft_cpcmd_fgcolor(FGCOLOR); \
}

As you can see, the issue is that the FG_COLOR (and BG_COLOR) is hardcoded for these items. I was getting lucky by calling the 'ft_cpcmd_fgcolor' command in my main display list, which is setting the colour on the EVE and when not pressed this structure/function is not adding any additional colour commands to the display list. However, when it is being pressed, the redraw over-rides any colour changes I make and auto-sets it to an average of the FG and BG colours, which is what causes the issue.

If I add an intermediate function for setting FG colour that sets the value locally (and change from a constant to a global variable) and then call the ft_cpcmd_fgcolor function with that colour then it will probably work.

Thanks for all your help guys, sometimes you just need someone to point out your own mistakes! Great community, keep it up :)

7
Discussion - EVE / Re: "Scroll Switch Page" Example available ?
« on: November 03, 2020, 10:56:16 AM »
Can you post a link to the video you followed? Or post a snippet you used?

8
Discussion - EVE / Button Press Colour
« on: November 03, 2020, 09:55:40 AM »
Hi, this probably a simple question to many but I couldn't find the answer in the FT81X Programmers guide so thought I would ask here.

I am able to set the colour of the button with the 'CMD_FGCOLOR', however, while the button is pressed it reverts back to the default colour(dark blue). I Initially thought that CMD_BGCOLOR would set the press colour, but it turns out that's not the case, and looking at the manual (section 5.2.2) it clearly stated CMD_BGCOLOR is not used.

So my question is simple: How do I set the button colour for when it is pressed?

Thanks!

9
Discussion - EVE / Re: Drawing filled polygon
« on: July 22, 2020, 02:16:19 PM »
Again, this worked perfectly, thank you!

10
Discussion - EVE / Re: Drawing filled polygon
« on: July 20, 2020, 05:30:19 PM »

This code works to produce your shape using a similar technique to what you were already using but with a left hand edge strip.

Code: [Select]
CLEAR(1, 1, 1)); // clear screen

COLOR_RGB(255, 100, 0)
STENCIL_OP(INCR,INCR)
COLOR_MASK(0,0,0,0)
BEGIN(EDGE_STRIP_L)
VERTEX2II(30,100,0,0)
VERTEX2II(100,100,0,0)
VERTEX2II(150,150,0,0)
VERTEX2II(150,250,0,0)
VERTEX2II(100,300,0,0)
VERTEX2II(30,300,0,0)
VERTEX2II(80,250,0,0)
VERTEX2II(80,150,0,0)
VERTEX2II(30,100,0,0)
END()

COLOR_MASK(1,1,1,1) )
STENCIL_FUNC(EQUAL, 1, 255)
BEGIN(EDGE_STRIP_L)
VERTEX2II(300,0,0,0)
VERTEX2II(300,300,0,0)
END()

STENCIL_FUNC(ALWAYS,0,255)
LINE_WIDTH(32)
COLOR_RGB(255, 255, 255)
BEGIN(LINE_STRIP)
VERTEX2II(30,100,0,0)
VERTEX2II(100,100,0,0)
VERTEX2II(150,150,0,0)
VERTEX2II(150,250,0,0)
VERTEX2II(100,300,0,0)
VERTEX2II(30,300,0,0)
VERTEX2II(30,300,0,0)
VERTEX2II(80,250,0,0)
VERTEX2II(80,150,0,0)
VERTEX2II(30,100,0,0)
END()
DISPLAY()

This works perfectly, thank you BRT Community! And thank you for accepting me into the community, hopefully once I've got to grips with it a bit more I can help others out, as this has helped me out a lot!

As a further question, how much effort would it be to fill that polygon with a gradient rather than just a solid colour? Is it even possible, perhaps using the SCISSOR_XY?

Thanks again!

11
Discussion - EVE / Drawing filled polygon
« on: July 20, 2020, 09:32:26 AM »
Hi all,

I need to draw the following shape but I'm not sure how is best to do it with the minimal number of instructions (as I need a few of them and don't want to fill my display list).


I can draw the outline very easy with
Code: [Select]
BEGIN(LINE_STRIP)
VERTEX2II(150, 200, 0, 0)
VERTEX2II(200, 200, 0, 0)
VERTEX2II(225, 225, 0, 0)
VERTEX2II(225, 275, 0, 0)
//etc...

However I also need to fill it in. I tried doing:
Code: [Select]
STENCIL_OP(INCR, INCR)
COLOR_MASK(0, 0, 0, 0)
BEGIN(EDGE_STRIP_B)
//draw lines
END()
STENCIL_FUNC(EQUAL, 1, 255)
BEGIN(EDGE_STRIP_B)
//draw lines again
END()

But this only fills in part of the polygon, and leaves parts of it unfilled. Do I need to split this shape up into 3 mini shapes (which seems like a lot of extra unnecessary instructions added to the display list) or can I use a different method, maybe the scissor?

If possible I wan't to avoid loading in bitmaps because they never work quite how I want them too, I'd have to load in separate ones for filled and unfilled, and I don't have a lot of space to store them. Would prefer a display list option, which I'm sure must be possible.

I have tried a lot of different things so if anyone want's to take on this challenge and finds any code they could share that could create this shape then it would be hugely appreciated!

_ Image doesn't seem to want to display so I have attached it to this post) _

Pages: [1]