quipu Posted April 5, 2018 Report Share Posted April 5, 2018 I add for my STM32 board ginput toggle driver. I created a new directory ugfx\drivers\ginput\toggle\STM32_HAL with: ginput_lld_toggle_hal.c ginput_lld_toggle_config.h also, in inc directory I add: ginput_lld_toggle_board.h In gfxconf.h i enable: GFX_USE_GINPUT GINPUT_NEED_TOGGLE GFX_USE_GEVENT GFX_USE_GTIMER How can i test the toggle driver? ginput_lld_toggle_board.h ginput_lld_toggle_hal.c ginput_lld_toggle_config.h Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted April 5, 2018 Report Share Posted April 5, 2018 I haven't checked your board file but when it comes to testing you can either assign the toggle to a widget (eg. pushbutton widgets accept toggle roles) and see whether the button visibly changes state. Other than that you can just setup a listener for toggle events yourself and check whether you receive anything. Thinking of this... you can also just call ginputGetToggleStatus() in your application to poll the state Link to comment Share on other sites More sharing options...
quipu Posted April 5, 2018 Author Report Share Posted April 5, 2018 @Joel Bodenmann it seems to work I tested it with the following code GSourceHandle upHandle = ginputGetToggle(GINPUT_TOGGLE_ESC); geventListenerInit(&pl); geventAttachSource(&pl, upHandle, GLISTEN_TOGGLE_ON|GLISTEN_TOGGLE_OFF); while (1) { event = geventEventWait(&pl, 5000); if(event) printf("Pressed\n"); } I have also added the following define in the file ginput_lld_toggle_board.h (attached) Now the big questions: Q1: Can I create a list that I scroll with the UP and DOWN keys? Q2: If yes, when I press the MODE key can I enter another list? Q3: If yes, in the second list, I can go back to the previous one by pressing the ESC key etc. ginput_lld_toggle_board.h Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted April 5, 2018 Report Share Posted April 5, 2018 Glad to hear that you got it working! Yes, that's already implemented. Just assign the toggle(s) to the list widget Yes, selecting an item via a toggle is also already implemented. Of course, you'll have to do the "switching to another list" part yourself - just as you'd have to do with a touchscreen implementation. I don't think that the default list widget has a toggle input for that as it's not really the list's job. Instead, just assign a toggle to some other event (you can manually fire the event) to get a "BACK" event just as you're getting "UP", "DOWN" and "SELECT" events already from the list itself. Link to comment Share on other sites More sharing options...
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