<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to BlinkingLED</title><link>https://sourceforge.net/p/cuml/wiki/BlinkingLED/</link><description>Recent changes to BlinkingLED</description><atom:link href="https://sourceforge.net/p/cuml/wiki/BlinkingLED/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 25 Oct 2017 14:28:28 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/cuml/wiki/BlinkingLED/feed" rel="self" type="application/rss+xml"/><item><title>BlinkingLED modified by Petr Pazourek</title><link>https://sourceforge.net/p/cuml/wiki/BlinkingLED/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v18
+++ v19
@@ -30,9 +30,9 @@
 * HSM_Setup.h - through this setup file should be your state machines connected with the rest of the code. It's generated only if it doesn't exist yet.

 ##Create BSP and the main entry
-I have found a nice piece of code implementing the timer for Win32 and Linux as well at https://www.teuniz.net/Timer_code/. We will use it as timer BSP.
+I have found a nice piece of the code implementing the timer for Win32 and Linux as well at https://www.teuniz.net/Timer_code/. We will use it as the timer BSP.

-The main.c is the main entry, is has to initialise the HSM framework, and timer. There are also implemented helper functuion such as LedOn() and LedOff().
+The main.c is the main entry, it has to initialise the HSM framework and timer. There are also implemented helper functions such as LedOn() and LedOff().
 ~~~
 #include &amp;lt;stdio.h&amp;gt;
 #include &amp;lt;stdlib.h&amp;gt;
@@ -82,7 +82,7 @@
 ~~~

 ##Modify the HSM_Setup.h
-The compiler needs to know prototypes os all function we used in the diagram. The HSM_Setup.h is the right file where to define the protopypes or to include header files. Simply add the declaration as follows:
+The compiler needs to know prototypes of all functions we used in the diagram. The HSM_Setup.h is the right file where to define protopypes or to include header files. Simply add the declaration as follows:
 ~~~
 // Include all files you need here
 #include &amp;lt;stdint.h&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Petr Pazourek</dc:creator><pubDate>Wed, 25 Oct 2017 14:28:28 -0000</pubDate><guid>https://sourceforge.net62ad0467deaa4942378ae7eb122f07daea191e26</guid></item><item><title>BlinkingLED modified by Petr Pazourek</title><link>https://sourceforge.net/p/cuml/wiki/BlinkingLED/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v17
+++ v18
@@ -12,7 +12,7 @@
 + The "On" state turns the LED on in the entry action (LedOn();),
 + When the eTimeout event arrives in the "On" state, the "On" state transitions back to the "Off" state. The cycle repeats forever because the eTimeout events keep getting generated at the pre-determined rate.

-The diagram is exported into the [XMI file](https://sourceforge.net/p/cuml/wiki/BlinkingLED/attachment/BlinkingLED.xmi) you can find attached.
+The diagram is exported into the [XMI file](https://sourceforge.net/projects/cuml/files/examples/BlinkingLED/BlinkingLED.xmi/download) you can find attached.

 ##Generating Code
 Open console and type in the following command line.
@@ -119,3 +119,5 @@

 That's all. Try to run the executable file blinkingLED.exe.
 ![Blinking LED in WIN32 console](https://sourceforge.net/p/cuml/wiki/BlinkingLED/attachment/BlinkingLED_console.png)
+
+You can download the [source code](https://sourceforge.net/projects/cuml/files/examples/BlinkingLED/BlinkingLED_src.zip/download) and the [diagram](https://sourceforge.net/projects/cuml/files/examples/BlinkingLED/BlinkingLED.zargo/download)
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Petr Pazourek</dc:creator><pubDate>Wed, 25 Oct 2017 11:48:33 -0000</pubDate><guid>https://sourceforge.net59f5a675b339a529b7f17b566f9cf842a5e3c04a</guid></item><item><title>BlinkingLED modified by Petr Pazourek</title><link>https://sourceforge.net/p/cuml/wiki/BlinkingLED/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Petr Pazourek</dc:creator><pubDate>Wed, 25 Oct 2017 11:42:46 -0000</pubDate><guid>https://sourceforge.net054ace0536d6d62444d93fe63fd758572039ce63</guid></item><item><title>BlinkingLED modified by Petr Pazourek</title><link>https://sourceforge.net/p/cuml/wiki/BlinkingLED/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v15
+++ v16
@@ -82,7 +82,7 @@
 ~~~

 ##Modify the HSM_Setup.h
-The compiler needs to know prototypes os all function we have used in the diagram. The HSM_Setup.h is the right file where to define the protopypes or to include helper files. Simply add the declaration as follows:
+The compiler needs to know prototypes os all function we used in the diagram. The HSM_Setup.h is the right file where to define the protopypes or to include header files. Simply add the declaration as follows:
 ~~~
 // Include all files you need here
 #include &amp;lt;stdint.h&amp;gt;
@@ -94,8 +94,8 @@

 ##Makefile and compilation
 To be able to build the program on your computer a C-compiler is needed. You are free
-to use whatever compiler you have installed.
-The Makefile for MinGW gcc compiler is easy to write.
+to use whatever compiler you have installed. I used the GCC toolchain for MinGW.
+The Makefile is easy to write.
 ~~~
 CC = gcc
 CFLAGS = -I.
@@ -117,5 +117,5 @@
 gcc -o blinkingLED main.o blinkingLED_FSM.o HSM_Framework.o timer.o
 ~~~

-That's all. Your example blinking application is done, try to run the blinkingLED.exe
+That's all. Try to run the executable file blinkingLED.exe.
 ![Blinking LED in WIN32 console](https://sourceforge.net/p/cuml/wiki/BlinkingLED/attachment/BlinkingLED_console.png)
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Petr Pazourek</dc:creator><pubDate>Wed, 25 Oct 2017 09:50:04 -0000</pubDate><guid>https://sourceforge.nete15e6e1a916fd7dd0510d5d3e43c4df2f52c412e</guid></item><item><title>BlinkingLED modified by Petr Pazourek</title><link>https://sourceforge.net/p/cuml/wiki/BlinkingLED/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v14
+++ v15
@@ -6,11 +6,10 @@

 ![Blinking LED statechart diagram](https://sourceforge.net/p/cuml/wiki/BlinkingLED/attachment/BlinkingLED.png)

-1. The initial transition leads to the state "Off" which turns the LED off in the entry action (LedOff();),
-+ As second action a counter starts to countdown with time passed as a parameter.
+1. The initial transition contain an action which starts the timer responsible to generation of the eTimeout signal every half second,
++ The initial transition leads to the state "Off" which turns the LED off in the entry action (LedOff();),
 + When the eTimeout event arrives in the "Off" state, the "Off" state transitions to the "On" state,
 + The "On" state turns the LED on in the entry action (LedOn();),
-+ As second action a counter starts again to countdown with time passed as a parameter.
 + When the eTimeout event arrives in the "On" state, the "On" state transitions back to the "Off" state. The cycle repeats forever because the eTimeout events keep getting generated at the pre-determined rate.

 The diagram is exported into the [XMI file](https://sourceforge.net/p/cuml/wiki/BlinkingLED/attachment/BlinkingLED.xmi) you can find attached.
@@ -31,10 +30,92 @@
 * HSM_Setup.h - through this setup file should be your state machines connected with the rest of the code. It's generated only if it doesn't exist yet.

 ##Create BSP and the main entry
+I have found a nice piece of code implementing the timer for Win32 and Linux as well at https://www.teuniz.net/Timer_code/. We will use it as timer BSP.
+
+The main.c is the main entry, is has to initialise the HSM framework, and timer. There are also implemented helper functuion such as LedOn() and LedOff().
+~~~
+#include &amp;lt;stdio.h&amp;gt;
+#include &amp;lt;stdlib.h&amp;gt;
+#include "HSM_Framework.h"
+#include "blinkingLED_FSM.h"
+#include "timer.h"
+
+void LedOn(void)
+{
+    printf("LED ON\n");
+}
+
+void LedOff(void)
+{
+    printf("LED OFF\n");
+}
+
+void TimerHandler(void)
+{
+    HSM_AddPendingEvent( &amp;amp;blinkingLED_FSM, eTimeout );
+}
+
+void StartTimer(int ms)
+{
+    if(start_timer(ms, &amp;amp;TimerHandler))
+    {
+        printf("\n timer error\n");
+        exit(EXIT_FAILURE);
+    }
+}
+
+int main(void)
+{
+    //first of all we need to init state machine framework
+    HSM_Init();
+
+    printf("\npress ctl-c to quit.\n");
+
+    //the main infinite loop
+    while(1)
+    {
+        HSM_ProcessEvents();
+    }
+
+    return EXIT_SUCCESS;
+}
+~~~

 ##Modify the HSM_Setup.h
+The compiler needs to know prototypes os all function we have used in the diagram. The HSM_Setup.h is the right file where to define the protopypes or to include helper files. Simply add the declaration as follows:
+~~~
+// Include all files you need here
+#include &amp;lt;stdint.h&amp;gt;
+
+extern void LedOn(void);
+extern void LedOff(void);
+extern void StartTimer(int ms);
+~~~

 ##Makefile and compilation
+To be able to build the program on your computer a C-compiler is needed. You are free
+to use whatever compiler you have installed.
+The Makefile for MinGW gcc compiler is easy to write.
+~~~
+CC = gcc
+CFLAGS = -I.
+LDFLAGS =

-TODO
+%.o: %.c
+   $(CC) $(CFLAGS) -o $@ -c $&amp;lt;

+blinkingLED: main.o blinkingLED_FSM.o HSM_Framework.o timer.o
+   $(CC) -o $@ $^ $(LDFLAGS)
+~~~
+
+Type make in a console located into your folder. You should see something like this:
+~~~
+gcc -I. -o main.o -c main.c
+gcc -I. -o blinkingLED_FSM.o -c blinkingLED_FSM.c
+gcc -I. -o HSM_Framework.o -c HSM_Framework.c
+gcc -I. -o timer.o -c timer.c
+gcc -o blinkingLED main.o blinkingLED_FSM.o HSM_Framework.o timer.o
+~~~
+
+That's all. Your example blinking application is done, try to run the blinkingLED.exe
+![Blinking LED in WIN32 console](https://sourceforge.net/p/cuml/wiki/BlinkingLED/attachment/BlinkingLED_console.png)
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Petr Pazourek</dc:creator><pubDate>Wed, 25 Oct 2017 09:44:09 -0000</pubDate><guid>https://sourceforge.net5d36f175081b1690c488f850a9f4b969c3361f65</guid></item><item><title>BlinkingLED modified by Petr Pazourek</title><link>https://sourceforge.net/p/cuml/wiki/BlinkingLED/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v13
+++ v14
@@ -4,7 +4,7 @@
 ##Drawing the Diagram
 For this example I was using the ArgoUML editor. The final diagram is shown on the picture below.

-![Blinking LED statechart diagram](https://sourceforge.net/p/cuml/wiki/Examples/attachment/BlinkingLED.png)
+![Blinking LED statechart diagram](https://sourceforge.net/p/cuml/wiki/BlinkingLED/attachment/BlinkingLED.png)

 1. The initial transition leads to the state "Off" which turns the LED off in the entry action (LedOff();),
 + As second action a counter starts to countdown with time passed as a parameter.
@@ -13,7 +13,7 @@
 + As second action a counter starts again to countdown with time passed as a parameter.
 + When the eTimeout event arrives in the "On" state, the "On" state transitions back to the "Off" state. The cycle repeats forever because the eTimeout events keep getting generated at the pre-determined rate.

-The diagram is exported into the [XMI file](https://sourceforge.net/p/cuml/wiki/Examples/attachment/BlinkingLED.xmi) you can find attached.
+The diagram is exported into the [XMI file](https://sourceforge.net/p/cuml/wiki/BlinkingLED/attachment/BlinkingLED.xmi) you can find attached.

 ##Generating Code
 Open console and type in the following command line.
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Petr Pazourek</dc:creator><pubDate>Wed, 25 Oct 2017 09:04:20 -0000</pubDate><guid>https://sourceforge.net3d526822036d191f95e5f62e31423a4b39606621</guid></item><item><title>BlinkingLED modified by Petr Pazourek</title><link>https://sourceforge.net/p/cuml/wiki/BlinkingLED/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Petr Pazourek</dc:creator><pubDate>Wed, 25 Oct 2017 09:02:58 -0000</pubDate><guid>https://sourceforge.netd07039fbfdd4da3b16de54bbee53fed01e387df2</guid></item><item><title>BlinkingLED modified by Petr Pazourek</title><link>https://sourceforge.net/p/cuml/wiki/BlinkingLED/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Petr Pazourek</dc:creator><pubDate>Wed, 25 Oct 2017 09:02:36 -0000</pubDate><guid>https://sourceforge.net5c6cc83450bd6363da4fc690da2a4eb956839121</guid></item><item><title>BlinkingLED modified by Petr Pazourek</title><link>https://sourceforge.net/p/cuml/wiki/BlinkingLED/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Petr Pazourek</dc:creator><pubDate>Wed, 25 Oct 2017 07:25:19 -0000</pubDate><guid>https://sourceforge.net499bd7c89948204e7d77c4f40acfad133b5ff511</guid></item><item><title>Examples modified by Petr Pazourek</title><link>https://sourceforge.net/p/cuml/wiki/Examples/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v9
+++ v10
@@ -2,7 +2,7 @@
 There is a very simple example which shows how to work with the Cuml tool.

 ##Drawing the Diagram
-For this example I was using the ArgoUML editor. The final diagram is shiown on the picture below.
+For this example I was using the ArgoUML editor. The final diagram is shown on the picture below.

 ![Blinking LED statechart diagram](https://sourceforge.net/p/cuml/wiki/Examples/attachment/BlinkingLED.png)

@@ -34,7 +34,7 @@

 ##Modify the HSM_Setup.h

-##Makefile a compilation
+##Makefile and compilation

 TODO

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Petr Pazourek</dc:creator><pubDate>Tue, 24 Oct 2017 14:57:21 -0000</pubDate><guid>https://sourceforge.netfaa40ede644b2c83d82fb32f8f537ff3f7f77588</guid></item></channel></rss>