AbleButtons V0.4.0
Lightweight button library for Arduino.
 
Loading...
Searching...
No Matches
Utils.cpp
Go to the documentation of this file.
1/**
2 * @file Utils.cpp TestAbleButton utilities for producing assert failures. This
3 * module provides an __assert function implementation for the assert() calls
4 * that fail. This function uses locally defined print-stream << operators to
5 * make it easier to output to the Serial object using C++ style stream output
6 * operations.
7 */
8#include "Utils.h"
9
10//
11// Implementation of assertSerial...
12//
13void assertSerial(const char *func, const char *file, int lineno, const __FlashStringHelper *exp) {
14 Serial << F("ERROR: Assertion [ ") << exp << F(" ] failed");
15
16 if(func) {
17 Serial << F(" in function '") << func;
18 }
19
20 Serial << F("' at line ") << lineno;
21
22 if(file) {
23 Serial << F(" of file ") << file;
24 }
25
26 Serial << endl;
27}
void assertSerial(const char *func, const char *file, int lineno, const __FlashStringHelper *exp)
Output assertion to Serial when the assertion expression is false.
Definition: Utils.cpp:13
Utility function declarations.
endl
Special type to allow Serial << endl to print a line and flush the stream.
Definition: Utils.h:45