File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed
libraries/Examples/examples/Advanced/fastShift Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ fastShiftIn() / fastShiftOut()
3+ By: Nathan Seidle
4+ SparkFun Electronics
5+ Date: July 8th, 2019
6+ License: This code is public domain.
7+
8+ SparkFun labored with love to create this code. Feel like supporting open source hardware?
9+ Buy a board from SparkFun! https://www.sparkfun.com/products/15376
10+
11+ This example shows how use the new fastShiftOut/In functions.
12+ */
13+
14+ // Can be any GPIO
15+ #define CLOCK_PIN 14
16+ #define DATA_PIN 27
17+
18+ void setup ()
19+ {
20+ Serial.begin (9600 );
21+ Serial.println (" SparkFun Fast Shiftout Example" );
22+
23+ pinMode (CLOCK_PIN, OUTPUT);
24+ pinMode (DATA_PIN, OUTPUT);
25+
26+ // enableBurstMode(); //Optional. Go to 96MHz. Roughly doubles the speed of shiftOut and fastShiftOut
27+
28+ // This is the standard shiftOut() method
29+ // while (1)
30+ // {
31+ // shiftOut(DATA_PIN, CLOCK_PIN, LSBFIRST, 0x0F); //Without BurstMode shiftOut runs at ~610kHz
32+ // }
33+
34+ // Example of new fastShiftOut() method
35+
36+ // Configure the pins that are to be used for Fast GPIO.
37+ enableFastShift (DATA_PIN, CLOCK_PIN);
38+ while (1 )
39+ {
40+ fastShiftOut (DATA_PIN, CLOCK_PIN, LSBFIRST, 0x0F ); // Without BurstMode fastShiftOut runs at 4MHz
41+ // byte incoming = fastShiftIn(DATA_PIN, CLOCK_PIN, LSBFIRST); //Without BurstMode fastShiftIn runs at 3.5MHz
42+ }
43+ }
44+
45+ void loop ()
46+ {
47+
48+ }
49+
50+
You can’t perform that action at this time.
0 commit comments