Ale Mansut / Mbed 2 deprecated RF_000

Dependencies:   mbed

main.cpp

Committer:
amansutti
Date:
2020-04-30
Revision:
0:ae9de0bbe204
Child:
1:2f4f6ea93f6b

File content as of revision 0:ae9de0bbe204:

#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);


    }
}