Skip to content

Commit

Permalink
Add empty CrashReport on Teensy 2.0, LC, 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulStoffregen committed Jul 3, 2021
1 parent 63b0363 commit 7f0c153
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 0 deletions.
19 changes: 19 additions & 0 deletions teensy/CrashReport.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <Arduino.h>
#include <CrashReport.h>

size_t CrashReportClass::printTo(Print& p) const
{
p.println("CrashReport is not available on Teensy 2.0");
return 1;
}

void CrashReportClass::clear()
{
}

CrashReportClass::operator bool()
{
return false;
}

CrashReportClass CrashReport;
13 changes: 13 additions & 0 deletions teensy/CrashReport.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include <Printable.h>
#include <WString.h>

class CrashReportClass: public Printable {
public:
virtual size_t printTo(Print& p) const;
void clear();
operator bool();
};

extern CrashReportClass CrashReport;
1 change: 1 addition & 0 deletions teensy/WProgram.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "WString.h"
#include "HardwareSerial.h"
#include "elapsedMillis.h"
#include "CrashReport.h"

uint16_t makeWord(uint16_t w);
uint16_t makeWord(byte h, byte l);
Expand Down
19 changes: 19 additions & 0 deletions teensy3/CrashReport.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <Arduino.h>
#include <CrashReport.h>

size_t CrashReportClass::printTo(Print& p) const
{
p.println("CrashReport is not available on Teensy LC & 3.x");
return 1;
}

void CrashReportClass::clear()
{
}

CrashReportClass::operator bool()
{
return false;
}

CrashReportClass CrashReport;
13 changes: 13 additions & 0 deletions teensy3/CrashReport.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include <Printable.h>
#include <WString.h>

class CrashReportClass: public Printable {
public:
virtual size_t printTo(Print& p) const;
void clear();
operator bool();
};

extern CrashReportClass CrashReport;
1 change: 1 addition & 0 deletions teensy3/WProgram.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#include "WString.h"
#include "elapsedMillis.h"
#include "IntervalTimer.h"
#include "CrashReport.h"

uint16_t makeWord(uint16_t w);
uint16_t makeWord(byte h, byte l);
Expand Down

1 comment on commit 7f0c153

@Defragster
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks right

Please sign in to comment.