HW_Lib/main.c

35 lines
722 B
C
Raw Normal View History

2024-05-09 05:56:55 +00:00
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "t_spi.h"
2024-05-09 06:38:55 +00:00
#include "t_iic.h"
2024-05-10 05:47:39 +00:00
#include "t_task.h"
#include "t_arg.h"
2024-05-20 13:53:19 +00:00
#include <time.h>
2024-05-10 05:47:39 +00:00
void Test(char *name, void (*pFunction)()) {
2024-05-20 13:53:19 +00:00
clock_t start, end;
double cpu_time_used;
2024-05-10 05:47:39 +00:00
printf("\n------< %s TEST >------\n", name);
2024-05-20 13:53:19 +00:00
start = clock();
2024-05-10 05:47:39 +00:00
pFunction();
2024-05-20 13:53:19 +00:00
end = clock();
cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
printf("\nTime taken by %s: %f seconds\n", name, cpu_time_used);
2024-05-10 05:47:39 +00:00
printf("\n------< %s END >------\n", name);
}
2024-05-09 06:38:55 +00:00
2024-05-09 05:56:55 +00:00
int main() {
srand((unsigned)time(NULL));
2024-05-10 05:47:39 +00:00
Test("SPI", Test_spi);
Test("IIC", Test_iic);
Test("ArgPase", Test_argpase);
Test("Task", Test_task);
2024-05-09 05:56:55 +00:00
return 0;
}