Exercise-007 ALARM_SETTING state
You have to implement this Alarm Setting state. It is pretty much similar to what you have already done in the Clock_Setting state. I think you have to repeat these internal substates here as well. And you can provide your own features or take a look at the demo video, where I explained how Alarm_Setting should be presented to the user.
As you can see in Figure 2, when it goes to the Alarm_Setting mode on the first row, the user should be allowed to make changes to the alarm time. And in the second row, the current time, that is the real-time should be displayed to the user. And you may display some custom characters like an Alarm symbol or something like that.
Also, please note that there is something called a Submachine. Using a sub-machine, you can reuse any part of the state machine.
For example, I want to reuse this Clock_Setting inside Alarm_Setting. Because, in this project, we know that Alarm_Setting also takes a similar pattern of substates. In that case, what you can do is you can create a Submachine of this, and you can then reuse that Submachine as Submachine instances.
Let me show you how to do that. But, it is not possible with a free tool. It needs commercial licensing. So, you have to obtain a commercial license to use that feature, but I’ll show you how to do that.
First, you have to select this Clock_Setting state and create a submachine. Right-click, and choose Add Sub-Machine from State.
Now you have created a Submachine. You can see that(Figure 4), you can give any name for that Submachine. And also, you can use the Entry and Exit points to define the interfaces.
After that, what you can do is you save that, and you can use the instance of this Clock_Setting Submachine here. Just add the sub-machine state. And link this submachine state to submachine what you just created, that is Clock_Setting.
Now, this becomes a state of Clock_Setting sub-machine or an instance of Clock_Setting submachine. It inherits all the details of this composite state, like that you can do.
But, to use this submachine state, it has to be based on QMsm, not QHsm. Here you need to select QMsm. But, QMsm is not available in qpn(QP-Nano). That’s why it will not be possible for us to use this feature. And to use QMsm, you need a commercial license. Because that feature is not available with the free tool.
This I will explain for your information. If you get any chance, then you explore more on submachines by referring to the user manual of the tool. You complete this, and in the following article, we will test this.
FastBit Embedded Brain Academy Courses
Click here: https://fastbitlab.com/course1