Skip to main content
KM L.1
Associate III
July 20, 2020
Question

Hardware integration for qwerty keypad

  • July 20, 2020
  • 15 replies
  • 2318 views

..

This topic has been closed for replies.

15 replies

KM L.1
KM L.1Author
Associate III
July 20, 2020

I want to know how to make qwerty keypad to react to the hardware button.. please anyone support me ​

Alexandre RENOUX
Visitor II
July 20, 2020

Hello,

Could you be more precise ?

You want to be able to type on a qwerty keyboard and what you write is displayed on the screen right ?

But what board are you using ? You want to plug a qwerty keyboard to your board ?

You can look at this documentation page as a start : https://support.touchgfx.com/docs/development/board-bring-up/example-gpio

Please provide more information.

/Alexandre

KM L.1
KM L.1Author
Associate III
July 20, 2020

Yes I'm able to type on qwerty keyboard with touch and its displaying on the screen.

As a start I went through that document also and I also integrated the physical button, now I am not getting how to make qwerty keyboard to react to the hardware button as i want to operate the qwerty keyboard using joystick buttons not with touch.

STM32H743I-eval board we are using.

KM L.1
KM L.1Author
Associate III
July 20, 2020

I'm not getting the logic to make qwerty keypad to react to those buttons.......

Using those buttons I wanted to type on the qwerty keyboard and need to display that.

Alexandre RENOUX
Visitor II
July 20, 2020

Hello,

You will find examples available at this page. It will show you how to propagate the buttonController data to the GUI and use it.

https://support.touchgfx.com/docs/development/ui-development/touchgfx-engine-features/backend-communication#from-gui-task

/Alexandre

KM L.1
KM L.1Author
Associate III
July 20, 2020

I already went through this and also I have created tasks and hardware button is working fine.

But help me to operate qwerty keyboard using buttons.

KM L.1
KM L.1Author
Associate III
July 20, 2020

I have written like this

KM L.1
KM L.1Author
Associate III
July 20, 2020

uint8_t msg = 0;

if (xQueueReceive(gui_msg_q, &msg, 0) == pdTRUE)

 {

  // Queue is used as a flag, so don't check msg.

  // Full = PRESSED, Empty = Do nothing.

   btnPressed();

 }

#endif

}

KM L.1
KM L.1Author
Associate III
July 20, 2020

void MainView::getBuffer() // add

{

}

how to use the custom keyboard function over here to operate using button

KM L.1
KM L.1Author
Associate III
July 20, 2020

Actually Martin had told me to work on the physical button first then he is going to help me out , how to react to the custom keyboard

Alexandre RENOUX
Visitor II
July 21, 2020

Hello,

You will find enclosed a quick implementation of the keyboard using buttons.

I haven't tested it with the actual board but the simulator is working. To link each physical button to a certain value, you should create a ButtonController class as follows (also explained in the documentation) :

class CustomButtonController : public touchgfx::ButtonController
{
 virtual void init() { previousState = JOY_NONE; }
 virtual bool sample(uint8_t& key)
 {
 JOYState_TypeDef state = BSP_JOY_GetState();
 if (state == previousState)
 {
 return false;
 }
 previousState = state;
 switch(state)
 {
 case JOY_SEL:
 key = '5';
 return true;
 case JOY_DOWN:
 key = '2';
 return true;
 case JOY_UP:
 key = '8';
 return true;
 case JOY_LEFT:
 key = '4';
 return true;
 case JOY_RIGHT:
 key = '6';
 return true;
 
 }
 return false;
 }
private:
 JOYState_TypeDef previousState;
};

Here are the keys used for the keyboard (you can change the code as you like) :

  • '5' select the highlighted key and print the corresponding letter
  • '6' and '4' are used to navigate among the different keys
  • '8' allows you to select capslock, numbers/special characters and delete.

You will find the main function making what you want possible void KeyboardJoystick::externalKeyPressed(uint8_t c) in KeyboardJoystick.cpp (gui\src\common\KeyboardJoystick.cpp)

/Alexandre