|
@@ -12,7 +12,7 @@
|
|
* States and transits:
|
|
* States and transits:
|
|
*
|
|
*
|
|
*
|
|
*
|
|
- * OFF--(on)--> READY --(hit)--> HIT
|
|
|
|
|
|
+ * OFF--> ON --> READY --(hit)--> HIT
|
|
* ^ |
|
|
* ^ |
|
|
* | (ready)
|
|
* | (ready)
|
|
* | |
|
|
* | |
|
|
@@ -27,8 +27,9 @@ struct trigger {
|
|
volatile enum {
|
|
volatile enum {
|
|
TRIGGER_ERROR = -2,
|
|
TRIGGER_ERROR = -2,
|
|
TRIGGER_OFF = -1,
|
|
TRIGGER_OFF = -1,
|
|
- TRIGGER_READY = 0,
|
|
|
|
- TRIGGER_HIT = 1,
|
|
|
|
|
|
+ TRIGGER_ON = 0,
|
|
|
|
+ TRIGGER_READY = 1,
|
|
|
|
+ TRIGGER_HIT = 2,
|
|
} state;
|
|
} state;
|
|
const char *name;
|
|
const char *name;
|
|
};
|
|
};
|
|
@@ -50,7 +51,7 @@ static inline bool trigger_is_error(struct trigger *t)
|
|
static inline void trigger_on(struct trigger *t)
|
|
static inline void trigger_on(struct trigger *t)
|
|
{
|
|
{
|
|
TRIGGER_WARN_ONCE(t, TRIGGER_OFF);
|
|
TRIGGER_WARN_ONCE(t, TRIGGER_OFF);
|
|
- t->state = TRIGGER_READY;
|
|
|
|
|
|
+ t->state = TRIGGER_ON;
|
|
}
|
|
}
|
|
|
|
|
|
static inline void trigger_ready(struct trigger *t)
|
|
static inline void trigger_ready(struct trigger *t)
|