main
Last change
on this file since 32c7682 was 32c7682, checked in by Adrien Destugues <pulkomandy@…>, 12 years ago |
- Poll motor on pin status and report it in the GUI.
- Some cleanup of device class.
git-svn-id: svn://localhost/thomson@12 85ae3b6b-dc8f-4344-a89d-598714f2e4e5
|
-
Property mode
set to
100644
|
File size:
549 bytes
|
Line | |
---|
1 | #include "poller.h"
|
---|
2 |
|
---|
3 | #include "device.h"
|
---|
4 |
|
---|
5 | #include <stdint.h>
|
---|
6 |
|
---|
7 |
|
---|
8 | // Start status poller "thread"
|
---|
9 | int pollStatus(Ihandle* ih)
|
---|
10 | {
|
---|
11 | uint8_t status = Device::getDevice().getStatus();
|
---|
12 | if (status & 8)
|
---|
13 | IupSetAttribute(motoron, "VALUE", "0"); // motor OFF
|
---|
14 | else
|
---|
15 | IupSetAttribute(motoron, "VALUE", "1"); // motor ON
|
---|
16 | return IUP_DEFAULT;
|
---|
17 | }
|
---|
18 |
|
---|
19 | void startPolling() {
|
---|
20 | Ihandle* timer = IupTimer();
|
---|
21 | IupSetAttribute(timer, "TIME", "300");
|
---|
22 | IupSetCallback(timer, "ACTION_CB", pollStatus);
|
---|
23 | IupSetAttribute(timer, "RUN", "YES");
|
---|
24 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.