Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// ring.ESP32C3.ino
// ESP32C3 ring oscillator test
// connect GPIO 8 and 20
//
// Neil Gershenfeld 12/26/22
//
// This work may be reproduced, modified, distributed,
// performed, and displayed for any purpose, but must
// acknowledge this project. Copyright is retained and
// must be preserved. The work is provided as is; no
// warranty is provided, and users accept all liability.
//
uint32_t input,output;
void setup() {
pinMode(8,OUTPUT);
output = (1 << 8);
input = (1 << 20);
}
void loop() {
//
// direct port I/O version
// 3.79 MHz at 160 MHz clock
//
/**/
while (1) {
if (GPIO.in.val & input)
GPIO.out_w1tc.val = output;
else
GPIO.out_w1ts.val = output;
}
/**/
//
// Arduino version
// 736 kHz at 166 MHz clock
//
/*
while (1) {
if (digitalRead(20))
digitalWrite(8,LOW);
else
digitalWrite(8,HIGH);
}
*/
}