Skip to content

Commit 75699f8

Browse files
committed
Re-arrange examples
1 parent e44b069 commit 75699f8

File tree

8 files changed

+32
-19
lines changed

8 files changed

+32
-19
lines changed

libraries/Examples/examples/Example8_millis/Example8_millis.ino renamed to libraries/Examples/examples/Example3_Delay/Example3_Delay.ino

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,24 @@
55
This example demonstrates how to use millis() and micros()
66
*/
77

8-
void setup() {
8+
void setup()
9+
{
910

1011
Serial.begin(9600);
1112

12-
while(!Serial){}; //Wait for user to open terminal window
13+
while (!Serial)
14+
{
15+
}; //Wait for user to open terminal window
1316

14-
Serial.println("SparkFun Arduino Apollo3 STimer Example");
17+
Serial.println("SparkFun Arduino Apollo3 Delay Example");
1518
Serial.printf("Compiled on %s, %s\n\n", __DATE__, __TIME__);
1619
}
1720

1821
void loop()
1922
{
2023
Serial.printf("Sec: %d, millis: %d, micros: %d, systicks: 0x%08X, sysoverflows: 0x%08X\n", secs(), millis(), micros(), systicks(), sysoverflows());
21-
delay(1111); //Arbitrary delay
22-
}
24+
25+
delay(1111); //Arbitrary millisecond delay
26+
27+
delayMicroseconds(50); //Arbitrary microsecond delay
28+
}

libraries/Examples/examples/Example10_Interrupts/Example10_Interrupts.ino renamed to libraries/Examples/examples/Example7_AttachInterrupts/Example7_AttachInterrupts.ino

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,48 @@ The edge-based interrupts will clear the flag automatically.
1818
static uint32_t count = 0;
1919
bool interruptsEnabled = false;
2020

21-
void setup() {
21+
void setup()
22+
{
2223
// put your setup code here, to run once:
2324

2425
Serial.begin(9600);
2526
Serial.println("Interrupt testing");
2627

2728
pinMode(INT_PIN, INPUT_PULLUP);
28-
29+
2930
attachInterrupt(digitalPinToInterrupt(INT_PIN), myISR, RISING);
30-
// attachInterrupt(digitalPinToInterrupt(INT_PIN), myISR, FALLING);
31-
// attachInterrupt(digitalPinToInterrupt(INT_PIN), myISR, LOW);
32-
// attachInterrupt(digitalPinToInterrupt(INT_PIN), myISR, HIGH);
31+
// attachInterrupt(digitalPinToInterrupt(INT_PIN), myISR, FALLING);
32+
// attachInterrupt(digitalPinToInterrupt(INT_PIN), myISR, LOW);
33+
// attachInterrupt(digitalPinToInterrupt(INT_PIN), myISR, HIGH);
34+
// attachInterrupt(digitalPinToInterrupt(INT_PIN), myISR, CHANGE);
3335

34-
// // attaching a different interrupt to the same pin overwrites the existing ISR
35-
// attachInterruptArg(digitalPinToInterrupt(INT_PIN), myISRArg, &count, RISING);
36+
// // attaching a different interrupt to the same pin overwrites the existing ISR
37+
// attachInterruptArg(digitalPinToInterrupt(INT_PIN), myISRArg, &count, RISING);
3638

3739
interruptsEnabled = true;
3840
}
3941

40-
void loop() {
42+
void loop()
43+
{
4144
count++;
42-
if( count > 5 ){
43-
if(interruptsEnabled){
45+
if (count > 5)
46+
{
47+
if (interruptsEnabled)
48+
{
4449
detachInterrupt(digitalPinToInterrupt(INT_PIN));
4550
interruptsEnabled = false;
4651
}
4752
}
4853
delay(1000);
4954
}
5055

51-
void myISR( void ){
56+
void myISR(void)
57+
{
5258
Serial.println("Hi i am an ISR!");
5359
}
5460

55-
void myISRArg( void* arg ){
56-
uint32_t* local_count = (uint32_t*)arg;
57-
Serial.printf("The time is %d seconds\n", *(local_count) );
61+
void myISRArg(void *arg)
62+
{
63+
uint32_t *local_count = (uint32_t *)arg;
64+
Serial.printf("The time is %d seconds\n", *(local_count));
5865
}

0 commit comments

Comments
 (0)