NAME

k8055m_poll -- Wait for new input

LIBRARY

k8055-pic18f access library

SYNOPSIS

#include "k8055m.h"

int
k8055m_poll(int cardNumber);
    

DESCRIPTION

The k8055m library uses a background thread to continuously read the HID reports, sent by the k8055-pic18f card. This thread keeps track of all input port and counter changes. Functions like k8055m_get_digital_in() therefore have instant access to the last known state of input data.

However, a code construct like

while (k8055m_get_digital_in(theCard, 0)) {
    ...
}

will cause a busy loop, wasting an entire CPU core, until line I1 of theCard is released.

To avoid such busy loops, k8055m_recv() can be used to wait until a new HID report is available. k8055m_poll() can be used to find out if a call to k8055m_recv() will block or not.

RETURN VALUES

Returns 1 if a new HID report is available, 0 if not and -1 on error.