Files
OpenCellular/common
Bill Richardson 0c8c2e453a Add abstract "cond_t" type to detect state transitions.
We often need to watch for transitions between one state and another, so
that we can issue warnings or take action ONCE. This abstracts that "have I
already reacted to this" stuff into a single set of functions.

For example, this code reads a GPIO every time through the loop, but it only
generates an event when the GPIO value changes from 0 to 1:

    cond_t c;

    cond_init_false(&c);

    while(1) {
        int val = read_some_gpio();
        cond_set(&c, val);

        if (cond_went_true(&c))
            host_event(SOMETHING_HAPPENED);

        sleep(1);
    }

BUG=none
BRANCH=falco,peppy
TEST=manual

make BOARD=falco runtests

Change-Id: I42393fcf3c4eb71b9551118a0f442d55c0691315
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65071
2013-08-09 15:44:09 -07:00
..
2013-08-08 20:29:17 -07:00
2013-08-08 20:29:17 -07:00
2013-07-10 11:16:43 -07:00
2013-08-07 12:43:48 -07:00
2013-08-07 12:43:48 -07:00
2013-07-22 15:28:58 -07:00
2013-05-07 09:09:50 -07:00
2013-03-29 15:39:32 -07:00
2013-07-10 11:16:43 -07:00
2012-10-26 09:49:38 -07:00
2012-10-25 14:12:10 -07:00
2013-06-10 01:48:44 -07:00
2012-10-25 17:03:44 -07:00