@@ -9,10 +9,12 @@ Glossary
99 a unique ID plus optionally some data associated with it
1010
1111 *entry event *
12- an event sent to a state when the state is entered (**AM_EVT_FSM_ENTRY **)
12+ an event sent to a state when the state is entered.
13+ The event has ID :cpp:enumerator: `AM_EVT_FSM_ENTRY <am_fsm_evt_id::AM_EVT_FSM_ENTRY> `.
1314
1415 *exit event *
15- an event sent to a state when the state is exited (**AM_EVT_FSM_EXIT **)
16+ an event sent to a state when the state is exited.
17+ The event has ID :cpp:enumerator: `AM_EVT_FSM_EXIT <am_fsm_evt_id::AM_EVT_FSM_EXIT> `.
1618
1719 *state *
1820 an event handler. `Idle `, `Processing ` and `Completed ` are all states
@@ -45,7 +47,7 @@ This library is ideal for applications that require structured and manageable
4547state control in an embedded system or other C-based environments.
4648
4749The FSM is a combination of one or more state-handler functions of
48- type ** am_fsm_state ** .
50+ type :cpp:type: ` am_fsm_state_fn ` .
4951
5052Example FSM
5153============
@@ -85,19 +87,19 @@ processes it accordingly.
8587
8688FSM reserved events are defined as follows:
8789
88- - ** AM_EVT_FSM_ENTRY ** : Indicates the entry into a state. Entry actions are executed here.
89- - ** AM_EVT_FSM_EXIT ** : Indicates the exit from a state. Exit actions are executed here.
90+ - :cpp:enumerator: ` AM_EVT_FSM_ENTRY <am_fsm_evt_id::AM_EVT_FSM_ENTRY> ` : Indicates the entry into a state. Entry actions are executed here.
91+ - :cpp:enumerator: ` AM_EVT_FSM_EXIT <am_fsm_evt_id::AM_EVT_FSM_EXIT> ` : Indicates the exit from a state. Exit actions are executed here.
9092
91- The ** am_fsm_dispatch() ** function is used to send events to the FSM.
93+ The :cpp:func: ` am_fsm_dispatch() ` function is used to send events to the FSM.
9294
9395State Transition
9496================
9597
9698The library supports two main types of state transitions:
9799
98- 1. Standard Transition (** AM_FSM_TRAN() ** ):
100+ 1. Standard Transition (:c:macro: ` AM_FSM_TRAN() ` ):
99101 Moves directly from the current state to the new state.
100- 2. Redispatch Transition (** AM_FSM_TRAN_REDISPATCH() ** ):
102+ 2. Redispatch Transition (:c:macro: ` AM_FSM_TRAN_REDISPATCH() ` ):
101103 Transitions to a new state and redispatches the event for further processing.
102104
103105Both type of state transitions are used within state handlers to initiate
@@ -115,12 +117,12 @@ Initial State
115117=============
116118
117119The initial state of the FSM is provided during the FSM’s construction
118- using the ** am_fsm_ctor() ** function.
120+ using the :cpp:func: ` am_fsm_ctor() ` function.
119121
120122This state is set to handle any initial setup required by the FSM and
121123ensures that the FSM begins with a predictable configuration.
122124
123- The function ** am_fsm_init() ** initiates the FSM with an optional initial event.
125+ The function :cpp:func: ` am_fsm_init() ` initiates the FSM with an optional initial event.
124126
125127Example:
126128
@@ -136,12 +138,12 @@ to proceed to the appropriate active state.
136138FSM Coding Rules
137139================
138140
139- 1. FSM states must be represented by event handlers of type ** am_fsm_state_fn ** .
141+ 1. FSM states must be represented by event handlers of type :cpp:type: ` am_fsm_state_fn ` .
1401422. The name of the first argument of all user event handler functions
141143 must be **me **.
1421443. For convenience instead of using **struct am_fsm *me ** the first argument
143145 can point to a user structure. In this case the user structure
144- must have **struct am_fsm ** instance as its first field.
146+ must have **struct ** :cpp:struct: ` am_fsm ` instance as its first field.
145147 For example, the first argument can be **struct foo *me **, where
146148 **struct foo ** is defined like this:
147149
@@ -156,19 +158,23 @@ FSM Coding Rules
156158 events.
1571595. Avoid placing any code with side effects outside of the switch-case of
158160 event handlers.
159- 6. Processing of **AM_EVT_FSM_ENTRY ** and **AM_EVT_FSM_EXIT ** events should
161+ 6. Processing of :cpp:enumerator: `AM_EVT_FSM_ENTRY <am_fsm_evt_id::AM_EVT_FSM_ENTRY> ` and
162+ :cpp:enumerator: `AM_EVT_FSM_EXIT <am_fsm_evt_id::AM_EVT_FSM_EXIT> ` events should
160163 not trigger state transitions. It means that user event handlers should
161- not return ** AM_FSM_TRAN() ** or ** AM_FSM_TRAN_REDISPATCH() ** for
164+ not return :c:macro: ` AM_FSM_TRAN() ` or :c:macro: ` AM_FSM_TRAN_REDISPATCH() ` for
162165 these events.
166+ 7. Processing of :cpp:enumerator: `AM_EVT_FSM_ENTRY <am_fsm_evt_id::AM_EVT_FSM_ENTRY> ` and
167+ :cpp:enumerator: `AM_EVT_FSM_EXIT <am_fsm_evt_id::AM_EVT_FSM_EXIT> ` events should be
168+ done at the top of the corresponding event handler for better readability.
163169
164170FSM Initialization
165171==================
166172
167173FSM initialization is divided into the following two steps for increased
168174flexibility and better control of the initialization timeline:
169175
170- 1. the state machine constructor (** am_fsm_ctor() ** )
171- 2. the initial transition (** am_fsm_init() ** ).
176+ 1. the state machine constructor (:cpp:func: ` am_fsm_ctor() ` )
177+ 2. the initial transition (:cpp:func: ` am_fsm_init() ` ).
172178
173179Transition To History
174180=====================
@@ -204,7 +210,7 @@ happen from state *A* or state *B*. As an example, assume the the FSM
204210is in the state *A *.
205211
206212The user code stores the current state in a local variable of type
207- ** am_fsm_state_fn ** . This is done with:
213+ :cpp:type: ` am_fsm_state_fn ` . This is done with:
208214
209215.. code-block :: C
210216
0 commit comments