Hi, in my application using Teensy 3.2, I need to read a signal from an external hardware into my c++ application (Windows 10). We agreed with the hardware vendor that they would close a contact on a pair of wires I give them.
So, I give them 2 wires: one connected to common GND, and a pin 16, which I pull up, and read.
I'm using Paul's USBHid library. On windows c++ code side, I call rawhid_recv() from an infinite loop as fast as I can, and as soon as I get a 0 - I know there has been contact closure.
It all works fine, but this application is intended to run for months and years, and there are other devices on that USB hub, and I just don't know if having a thread in windows that runs a tight loop like this 24/7 (100s or even 1000s of times a sec) is a good idea. Is it possible to do this somehow w/o polling? E.g. trigger an event in windows somehow when a pin value is set in Teensy? I can't dedicate the whole MCU to this one task, though, it must perform other things, like driving stepper motors.
Thanks!
So, I give them 2 wires: one connected to common GND, and a pin 16, which I pull up, and read.
I'm using Paul's USBHid library. On windows c++ code side, I call rawhid_recv() from an infinite loop as fast as I can, and as soon as I get a 0 - I know there has been contact closure.
It all works fine, but this application is intended to run for months and years, and there are other devices on that USB hub, and I just don't know if having a thread in windows that runs a tight loop like this 24/7 (100s or even 1000s of times a sec) is a good idea. Is it possible to do this somehow w/o polling? E.g. trigger an event in windows somehow when a pin value is set in Teensy? I can't dedicate the whole MCU to this one task, though, it must perform other things, like driving stepper motors.
Thanks!