From 0120e9729d10c21558b4dfdb54ad202fe39243c9 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Wed, 12 May 2010 23:15:25 +0200 Subject: digital/io/src: moved FSM transition table to flash --- digital/io/src/fsm.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'digital/io/src/fsm.h') diff --git a/digital/io/src/fsm.h b/digital/io/src/fsm.h index f06c92fb..82a860a8 100644 --- a/digital/io/src/fsm.h +++ b/digital/io/src/fsm.h @@ -25,6 +25,17 @@ * * }}} */ +#ifndef HOST + +# include + +#else + +# define PROGMEM +# define pgm_read_word(addr) (*(addr)) + +#endif + /** * The io board includes an FSM with several concurrent active states. * @@ -88,6 +99,10 @@ struct fsm_t }; typedef struct fsm_t fsm_t; +#define FSM_TRANSITION(fsm, state, event) \ + ((fsm_transition_t) pgm_read_word ( \ + &(fsm)->transition_table[(state) * (fsm)->events_nb + (event)])) + /** Reset a FSM. */ void fsm_init (fsm_t *fsm); -- cgit v1.2.3