Arduino-OWI
One-Wire Interface (OWI) library for Arduino
Benchmark.ino
Go to the documentation of this file.
1 #include "GPIO.h"
2 #include "TWI.h"
3 #include "Hardware/TWI.h"
4 #include "OWI.h"
5 #include "Hardware/OWI.h"
6 #include "benchmark.h"
7 
8 Hardware::TWI twi;
10 
11 void setup()
12 {
13  Serial.begin(57600);
14  while (!Serial);
15  BENCHMARK_BASELINE(1);
16 }
17 
18 void loop()
19 {
20  // Measure the standard 1-wire bus manager functions
21  // All measurements are in micro-seconds
22 
23  uint8_t rom[owi.ROM_MAX];
24  uint8_t dir = 0;
25 
26  // Cyclic Redundancy Check per byte
27  MEASURE(owi.crc_update(0,0));
28 
29  // Reset pulse and presence check
30  MEASURE(owi.reset());
31 
32  // Write bit and byte
33  MEASURE(owi.write(0,1));
34  MEASURE(owi.write(1,1));
35  MEASURE(owi.write(0x00));
36  MEASURE(owi.write(0xff));
37 
38  // Read bit and byte
39  MEASURE(owi.read(1));
40  MEASURE(owi.read());
41 
42  // Triplet; read two bits and write one
43  MEASURE(owi.triplet(dir));
44 
45  // Standard rom functions
46  MEASURE(owi.read_rom(rom));
47  MEASURE(owi.skip_rom());
48  MEASURE(owi.match_rom(rom));
49  MEASURE(owi.search_rom(0, rom));
50  MEASURE(owi.alarm_search(rom));
51 
52  Serial.println();
53  delay(2000);
54 }
Hardware::TWI twi
Definition: Benchmark.ino:8
Software::Serial< BOARD::D0 > Serial
Definition: Alarm.ino:8
void loop()
Definition: Benchmark.ino:15
Software::OWI< BOARD::D7 > owi
Definition: Benchmark.ino:6
void setup()
Definition: Benchmark.ino:8