1 /*
2  * Copyright (c) 2024 Glenn Andrews
3  * State Machine example copyright (c) Miro Samek
4  *
5  * Implementation of the statechart in Figure 2.11 of
6  * Practical UML Statecharts in C/C++, 2nd Edition by Miro Samek
7  * https://www.state-machine.com/psicc2
8  * Used with permission of the author.
9  *
10  * SPDX-License-Identifier: Apache-2.0
11  */
12 
13 #ifndef _HSM_PSICC2_THREAD_H
14 #define _HSM_PSICC2_THREAD_H
15 
16 #define HSM_PSICC2_THREAD_STACK_SIZE       1024
17 #define HSM_PSICC2_THREAD_PRIORITY         7
18 #define HSM_PSICC2_THREAD_EVENT_QUEUE_SIZE 10
19 
20 /**
21  * @brief Event to be sent to an event queue
22  */
23 struct hsm_psicc2_event {
24 	uint32_t event_id;
25 };
26 
27 /**
28  * @brief List of events that can be sent to the state machine
29  */
30 enum demo_events {
31 	EVENT_A,
32 	EVENT_B,
33 	EVENT_C,
34 	EVENT_D,
35 	EVENT_E,
36 	EVENT_F,
37 	EVENT_G,
38 	EVENT_H,
39 	EVENT_I,
40 	EVENT_TERMINATE,
41 };
42 
43 /* event queue to post messages to */
44 extern struct k_msgq hsm_psicc2_msgq;
45 
46 /**
47  * @brief Initializes and starts the PSICC2 demo thread
48  * @param None
49  */
50 void hsm_psicc2_thread_run(void);
51 
52 #endif /* _HSM_PSICC2_THREAD_H */
53