Nikolay Posted September 20, 2017 Report Posted September 20, 2017 I have a driver for stmpe811. This is based on using i2c interrupts of stm32 (RXNE, ADDR, SB..). My function reading look as start exchange, wait and handled some interrupts. And at the end I get XY coordinates in interrupt's handler. How can I put this value in gwin? I see stmpe811 driver, but I don't understand how embed my read function, because uGWIN is a initiate gets of coordinates but i need backward.
Nikolay Posted September 20, 2017 Author Report Posted September 20, 2017 (edited) And I want don't use the timer in function _gmouseInitDriver. Is it possible? Quote // Ensure the Poll timer is started if (!gtimerIsActive(&MouseTimer)) gtimerStart(&MouseTimer, MousePoll, 0, TRUE, GINPUT_MOUSE_POLL_PERIOD); Maybe create function like "put_mouse_data_in_ginput"? Sometimes the timer is redundant and spends resources Edited September 20, 2017 by Nikolay
Nikolay Posted September 20, 2017 Author Report Posted September 20, 2017 And If I use in my function put_mouse_data_in_ginput() only steps 5...7 from function GetMouseReading()... Will this work?
inmarket Posted September 20, 2017 Report Posted September 20, 2017 Set the mouse timer period to TIME_INFINITE. This is done in your gfxconf.h file. In yiur driver interrupt save the x and y and then call MouseTimerJab (I think that is what it is called). Some time later the mouse code will call your driver read function and you can then return the values you saved in the interrupt handler. The reason you do not want to turn off the mouse timer is that there are all sorts of other things that are also being handled by the mouse timer. Also using the timer jab allows all the heavy cpu processing and inter-thread communication to happen outside the interrupt handler. Note that in our experience touch controller chips are very unreliable when run with interrupts. They tend to freeze up, give wrong values, sometimes just forget to interrupt at all or generate tonnes of spurious interrupts. For chips that supply a "touched" interrupt the point it generates the interrupt is invariably nowhere near as good or as reliable as we can determine for ourself. That is why for all existing mouse drivers except a couple of emulation touch drivers we have not used the interrupts - they are just too flaky.
Nikolay Posted October 2, 2017 Author Report Posted October 2, 2017 (edited) I don't find "MouseTimerJab". I found the function static void GetMouseReading (GMouse * m) but this is "static" and a don't understand how get "GMouse *m" in main Edited October 2, 2017 by Nikolay
inmarket Posted October 3, 2017 Report Posted October 3, 2017 That is not a function you should be calling. Whilst I may not have the Jab toutine name 100% correct (i am on my phone so can't look it up now) the method described above is the correct method. For example look at the Win32 mouse driver (part of the Win32 gdisp driver).
Nikolay Posted October 3, 2017 Author Report Posted October 3, 2017 ugfx_2.7\drivers\multiple\Win32\gdisp_lld_Win32.c Only this file fits your description. In this there is function void gfxEmulatorMouseInject(GDisplay *g, uint16_t buttons, coord_t x, coord_t y) But don't example how to use it. In particular how to get GDisplay*g in main. And there is no use of a timer. For example in STEmWin there are function GUI_PID_STATE ts_state = {TSC_data.x, TSC_data.y, TSC_data.touchState, LAYER_0}; GUI_TOUCH_StoreStateEx(&ts_state); simple and understandable When this function is called, the GUI react
inmarket Posted October 3, 2017 Report Posted October 3, 2017 Please listen. You are not looking for a function - you are looking for how the win32 code works. 1. When it gets a windows mouse message it just saves the values and then calls MouseTimerJab. 2. Sometime later the mouse code calls the mouse driver get routine which returns the values previously saved. You will need to follow a similar process. The code is not identical but the way it needs to work is. Please also take notice of the comments on interrupt driven touch devices. Generally they just do not work well.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now