diff --git a/developer_guides/firmware/components/component-overview.rst b/developer_guides/firmware/components/component-overview.rst index b403574b..b41bd57b 100644 --- a/developer_guides/firmware/components/component-overview.rst +++ b/developer_guides/firmware/components/component-overview.rst @@ -43,22 +43,10 @@ Entry called to create a new component device:: Handling the Component Device State *********************************** -Utility function ``comp_set_state()`` should be called a component code at -the beginning of its state transition to verify whether the trigger is valid -in the current state and set a new state accordingly to the state diagram. - .. uml:: images/comp-dev-states.pu + :caption: Component Device States -READY - This is an initial state of a component device once it is created. - -PREPARE - Transition to this state is usually invoked internally by the component's - implementation of the ``prepare()`` handler. - -ACTIVE, PAUSE - Transitions to these states is caused by external trigger passed to the - component's implementation of the ``trigger()`` handler. +Refer to ``comp_set_state()`` in :ref:`component-api` for details. Implementing Component API (comp_ops) ************************************* diff --git a/developer_guides/firmware/components/images/comp-dev-states.pu b/developer_guides/firmware/components/images/comp-dev-states.pu index 69c97b3d..8eda7e5a 100644 --- a/developer_guides/firmware/components/images/comp-dev-states.pu +++ b/developer_guides/firmware/components/images/comp-dev-states.pu @@ -1,16 +1,15 @@ hide empty description -[*] -right-> READY : comp_ops.new() +[*] -right-> COMP_STATE_READY : comp_ops.new() -READY -right-> PREPARE : prepare +COMP_STATE_READY -right-> COMP_STATE_PREPARE : COMP_TRIGGER_PREPARE -PREPARE --> ACTIVE : start -PAUSED --> ACTIVE : start +COMP_STATE_PREPARE --> COMP_STATE_ACTIVE : COMP_TRIGGER_START -ACTIVE --> PREPARE : stop, xrun -PAUSED --> PREPARE : stop, xrun +COMP_STATE_ACTIVE --> COMP_STATE_PREPARE : COMP_TRIGGER_STOP, COMP_TRIGGER_XRUN +COMP_STATE_PAUSED --> COMP_STATE_PREPARE : COMP_TRIGGER_STOP, COMP_TRIGGER_XRUN -ACTIVE -> PAUSED : pause +COMP_STATE_ACTIVE -> COMP_STATE_PAUSED : COMP_TRIGGER_PAUSE -PAUSED --> ACTIVE : release +COMP_STATE_PAUSED --> COMP_STATE_ACTIVE : COMP_TRIGGER_RELEASE -PREPARE --> READY : reset +COMP_STATE_PREPARE --> COMP_STATE_READY : COMP_TRIGGER_RESET