aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2017-08-11 18:45:50 +0000
committerRocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>2017-08-11 18:45:50 +0000
commit58e167350f007cfdc33bbb67e8042ffd9dee4297 (patch)
treeae5a2756481d5600c31d99ee2a4681c91a2bb5bc /demos
parente2f3acbc5cebf1dc2d7ad0a299acc222e8305afe (diff)
downloadChibiOS-58e167350f007cfdc33bbb67e8042ffd9dee4297.tar.gz
ChibiOS-58e167350f007cfdc33bbb67e8042ffd9dee4297.tar.bz2
ChibiOS-58e167350f007cfdc33bbb67e8042ffd9dee4297.zip
Added PIT implementation for ATSAMA5D2 (Still incomplete)
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10404 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos')
-rwxr-xr-xdemos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/main.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/main.c b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/main.c
index 44b9c0f4b..4009917da 100755
--- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/main.c
+++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED/main.c
@@ -17,7 +17,25 @@
#include "ch.h"
#include "hal.h"
-static uint32_t counter = 0;
+static uint32_t seconds_counter;
+static uint32_t minutes_counter;
+
+/*
+ * Seconds counter thread.
+ */
+static THD_WORKING_AREA(waThread1, 128);
+static THD_FUNCTION(Thread1, arg) {
+
+ (void)arg;
+
+ chRegSetThreadName("counter");
+
+ while (true) {
+ chThdSleepMilliseconds(1000);
+ seconds_counter++;
+ }
+}
+
/*
* Application entry point.
*/
@@ -33,7 +51,17 @@ int main(void) {
halInit();
chSysInit();
+ /*
+ * Creates the example thread.
+ */
+ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
+
+ /*
+ * Normal main() thread activity, in this demo it does nothing except
+ * increasing the minutes counter.
+ */
while (true) {
- counter++;
+ chThdSleepSeconds(60);
+ minutes_counter++;
}
}