summaryrefslogtreecommitdiff
path: root/digital/io/src/getsamples/getsamples.c
blob: 6044d0927475f103666b7a98665057dddac49d5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 * THIS IS AN AUTOMATICALLY GENERATED FILE, DO NOT EDIT!
 *
 * get_samples
 *
 * 
 */
#include "getsamples_cb.h"
#include <stddef.h>
#include <assert.h>

struct getsamples_t { getsamples_state_t fsm; };
 
/* get_samples transition table. */
static const getsamples_transition_t
getsamples_transition_table[GETSAMPLES_STATE_NB][GETSAMPLES_EVENT_NB] = {
    { getsamples__PREPARE_ARM__arm_prepared,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL },
    { NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL },
    { NULL,
      getsamples__FORWARD_CONTROL__move_finished,
      NULL,
      NULL,
      NULL,
      NULL },
    { NULL,
      getsamples__GO_TO_POSITION__move_finished,
      NULL,
      getsamples__GO_TO_POSITION__move_blocked,
      NULL,
      NULL },
    { NULL,
      NULL,
      NULL,
      NULL,
      getsamples__PREPARE_CLASSIFIER__classifer_prepared,
      NULL },
};

/* Initialise get_samples automaton. */
void
getsamples_init (getsamples_t *user)
{
    user->fsm = GETSAMPLES_STATE_GO_TO_POSITION;
}

/* Handle events on get_samples automaton. */
void
getsamples_handle_event (getsamples_t *user, getsamples_event_t event)
{
    assert (user);
    getsamples_state_t state = user->fsm;
    assert (state < GETSAMPLES_STATE_NB);
    assert (event < GETSAMPLES_EVENT_NB);
    getsamples_transition_t tr = getsamples_transition_table[state][event];
    assert (tr);
    getsamples_branch_t br = tr (user);
    assert (((br >> 16) & 0xff) == state);
    assert (((br >> 8) & 0xff) == event);
    user->fsm = br & 0xff;
}