Skip to content

Commit

Permalink
[bot] - autoformatted code
Browse files Browse the repository at this point in the history
  • Loading branch information
autoformatter[bot] committed Oct 16, 2024
1 parent 573eee9 commit 01b21c4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
56 changes: 27 additions & 29 deletions Watchdog/WatchdogCode/WatchdogCode.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,47 @@
#define RESET_PIN 0

volatile bool beat0 = 0;
volatile bool beat1 = 0;
volatile bool beat1 = 0;

ISR(PCINT0_vect){
if(digitalRead(HEARTBEAT_PIN_0) == HIGH){
beat0 = true;
ISR(PCINT0_vect) {
if (digitalRead(HEARTBEAT_PIN_0) == HIGH) {
beat0 = true;
}
if(digitalRead(HEARTBEAT_PIN_1) == HIGH){
beat1 = true;
if (digitalRead(HEARTBEAT_PIN_1) == HIGH) {
beat1 = true;
}
}

void setup(){
// setup
pinMode(HEARTBEAT_PIN_0, INPUT);
pinMode(HEARTBEAT_PIN_1, INPUT);
pinMode(RESET_PIN, OUTPUT);
digitalWrite(RESET_PIN, LOW);
void setup() {
// setup
pinMode(HEARTBEAT_PIN_0, INPUT);
pinMode(HEARTBEAT_PIN_1, INPUT);
pinMode(RESET_PIN, OUTPUT);
digitalWrite(RESET_PIN, LOW);

// any logical change interrupt
MCUCR &= ~((1<<ISC01)|(1<<ISC00));
MCUCR |= (1<<ISC00);
// enable Pin Change interrupt
GIMSK |= (1<<PCIE);
// enable SREG, I think the arduino sdk will do that
// any logical change interrupt
MCUCR &= ~((1 << ISC01) | (1 << ISC00));
MCUCR |= (1 << ISC00);
// enable Pin Change interrupt
GIMSK |= (1 << PCIE);
// enable SREG, I think the arduino sdk will do that

// enable pins
PCMSK |= (1<<PCINT3)|(1<<PCINT4);
// enable pins
PCMSK |= (1 << PCINT3) | (1 << PCINT4);

delay(10000); // wait 10s to start checking
delay(10000); // wait 10s to start checking
}

void loop(){

delay(5000); // check every 5s
if((beat0 || beat1) == false){ // if either beat hasn't changed
void loop() {
delay(5000); // check every 5s
if ((beat0 || beat1) == false) { // if either beat hasn't changed
// one of the tasks if frozen, reset
digitalWrite(RESET_PIN, HIGH);
delay(500);
digitalWrite(RESET_PIN, HIGH);
delay(500);
digitalWrite(RESET_PIN, LOW);
delay(5000); // give the pico time to setup again
delay(5000); // give the pico time to setup again
// clear beats
}
beat0 = false;
beat1 = false;

}
30 changes: 16 additions & 14 deletions Watchdog/WatchdogTesterPico/WatchdogTesterPico.ino
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
// pico code to test watchdog, flatlines after 50 iterations, resets around 100 iterations
// pico code to test watchdog, flatlines after 50 iterations, resets around 100
// iterations
#define h1 14
#define h2 15

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
pinMode(h1, OUTPUT);
pinMode(h2, OUTPUT);
pinMode(h1, OUTPUT);
pinMode(h2, OUTPUT);
}

int i = 0;
int i = 0;
// the loop function runs over and over again forever
void loop() {
Serial.println(i++);
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(250); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(250);
Serial.println(i++);
digitalWrite(LED_BUILTIN,
HIGH); // turn the LED on (HIGH is the voltage level)
delay(250); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(250);

if(i < 80){
digitalWrite(h1, (i & 0x1));
digitalWrite(h2, (i & 0x1));
if (i < 80) {
digitalWrite(h1, (i & 0x1));
digitalWrite(h2, (i & 0x1));
}
if(i == 50){
Serial.println("Flatline");
if (i == 50) {
Serial.println("Flatline");
}
}

0 comments on commit 01b21c4

Please sign in to comment.