| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

Speed_Test.ino
Go to the documentation of this file.
1
2 //#define SerialUSB Serial
3
4 void setup()
5 {
6 delay(1000);
7 SerialUSB.begin(115200);
8 while (!Serial); // wait for serial port to connect. Needed for native USB
9 }
10
11 void loop()
12 {
13 delay(1000);
14 SerialUSB.write("Hello!\n");
15 unsigned long StartTime;
16 unsigned long CurrentTime;
17 unsigned long ElapsedTime;
18
19 const uint16_t baseStrRepetion = 48;
20 const uint32_t baseStrSize = 64;
21 const uint32_t newStrSize = ((baseStrSize - 1)*baseStrRepetion) + 1;
22 uint32_t numIterations = 4096;
23
24 char baseStr[baseStrSize] = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\n";
25 char newStr[newStrSize];
26 int j = 0, k = 0;
27
28 // Populate newStr using baseStr
29 for(j = 0; j < (newStrSize - 1); ++j)
30 {
31 newStr[j] = baseStr[k];
32 k++;
33 if(k == (baseStrSize - 1))
34 {
35 k = 0;
36 continue;
37 }
38 }
39 newStr[newStrSize - 1] = '\0';
40
41 SerialUSB.write("Measuring time for new string:\n");
42 delay(1000);
43
44 StartTime = micros();
45 for(uint32_t i = 0; i< numIterations; ++i){
46 SerialUSB.write(newStr);
47 }
48 CurrentTime = micros();
49 ElapsedTime = CurrentTime - StartTime;
50 SerialUSB.print(newStrSize * numIterations);
51 SerialUSB.print(" characters in microSeconds = ");
52 SerialUSB.println(ElapsedTime);
53 delay(1000);
54
55 /* while(true)
56 {
57 }; */
58 }
59
60 void createRandomString(uint32_t size, char* newStr)
61 {
62
63 }
64
65 void createDefiniteString(char* newStr)
66 {
67
68 }
createDefiniteString
static void createDefiniteString(char *newStr)
Definition: Speed_Test.ino:65
createRandomString
static void createRandomString(uint32_t size, char *newStr)
Definition: Speed_Test.ino:60
setup
static void setup()
Definition: Speed_Test.ino:4
loop
static void loop()
Definition: Speed_Test.ino:11
i
static int i
Definition: DC2430A.ino:184