linux - How do I connect a hardware interrupt to Qt Emit? -


i'm building , embedded app , rather use hardware interrupt listener chew cpu cycles polling every 10th of second.

this can done since there listener hardware interrupts keyboard, mouse , networking. have hardware interrupt trigger qt emit signal.

thanks in advance.

example:
hardware interrupt -> readport() -> emit(value)

update
think work hear has experience this.

msn = new qsocketnotifier; // defined in .h qfile file("/dev/testdriver"); if(file.open(qfile::readonly)) {   qsocketnotifier msn(file.handle(), , qsocketnotifier::read);   msn.setenabled(true);   connect(msn, signal(activated(int)), &this, slot(readyread())); } 

not knowing else application, there may non-interrupt solution.

create subclass of qobject , move unique qthread.

in object, call starttimer(100).

in timerevent(), poll hardware. emit signal necessary.

in qt4, signals , slots automatically queued across threads.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -