2

My problem is......... I am trying to develop an application.In this application there are certain pages and which is displaying on the LCD on my board.and my board has a gpio button by default the value of this button is high when i press this button value of this button become low after releasing again high.i want to make my app interrupt based when i pressed hold button for 3 second display should be rotate and if i just press and release button page should change.In my app i have interface my gpio button.

QString btnInput = "/sys/class/gpio/gpioN/value";

In my apps I can read the value from value file when my app start after that if i press button nothing will happen.what should i do. how can i generate interrupt after pressing button.

please help me i am new in qt I start qt just before 2 week.

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
Rahul Chauhan
  • 37
  • 1
  • 2

1 Answers1

0

I can't tell for a Qt5 application actually (I don't have experience in the Qt field), but you may use a inotify file watcher with /sys/class/gpio/gpioN/value in user space.

That way your program will receive notifications (interrupts) whenever the value changes.

I'm almost sure there's also some (portable) Qt intrinsic mechanism, that resembles the same.


Update (after a little research):

Specifically for Qt I found this answer where the QFileSystemWatcher is mentioned for doing that portably.

Community
  • 1
  • 1
πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
  • Thank you sir for reply and i implemented it based upon changes it is generating interrupt but SIGNAL fileChanged() gets emited only once.but i want when ever i press the button interrupt should generate. please help me. – Rahul Chauhan Aug 22 '16 at 05:22
  • QFileSystemWatcher is not the specific command to use. It can not figure the system files changed. Maybe this link is useful https://stackoverflow.com/questions/23823279/handle-gpio-button-event-with-c – H.Ghassami Feb 19 '18 at 05:59