Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 0:ae9de0bbe204
- Child:
- 1:2f4f6ea93f6b
diff -r 000000000000 -r ae9de0bbe204 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Apr 30 08:48:57 2020 +0000
@@ -0,0 +1,57 @@
+#include "mbed.h"
+extern "C" {
+#include "fx.h"
+}
+
+#include <time.h>
+void sleepcp(int milliseconds);
+
+void sleepcp(int milliseconds) // Cross-platform sleep function
+{
+ clock_t time_end;
+ time_end = clock() + milliseconds * CLOCKS_PER_SEC/1000;
+ while (clock() < time_end) {
+ }
+}
+
+
+//------------------------------------
+// Hyperterminal configuration
+// 9600 bauds, 8-bit data, no parity
+//------------------------------------
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+
+DigitalOut myled(LED1);
+
+int main()
+{
+
+ int Repetitions = 100;
+ int FxToCall = 50;
+
+ float x[20];
+ int count = 0;
+
+ while(1) {
+ pc.printf("Starting %d repetitions\r\n",Repetitions);
+
+ clock_t start, end;
+ double cpu_time_used;
+ start = clock();
+
+ count = 0;
+
+ for (int r=0; r<Repetitions; r++) {
+ for(int i=0; i<FxToCall; i++) {
+ count += fxList[i](x);
+ }
+ }
+
+ end = clock();
+ cpu_time_used = ((double) (end - start)) / (CLOCKS_PER_SEC * 1000);
+ pc.printf("Ticks elapsed: %d - Millisecs: %f",(end-start),cpu_time_used);
+
+
+ }
+}