Skip to content

Commit

Permalink
use SERIAL replace Serial
Browse files Browse the repository at this point in the history
  • Loading branch information
baorepo committed Aug 26, 2019
1 parent ac34962 commit f9c62da
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 18 deletions.
22 changes: 11 additions & 11 deletions PN532/PN532.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ void PN532::PrintHex(const uint8_t *data, const uint32_t numBytes)
#ifdef ARDUINO
for (uint8_t i = 0; i < numBytes; i++) {
if (data[i] < 0x10) {
Serial.print(" 0");
SERIAL.print(" 0");
} else {
Serial.print(' ');
SERIAL.print(' ');
}
Serial.print(data[i], HEX);
SERIAL.print(data[i], HEX);
}
Serial.println("");
SERIAL.println("");
#else
for (uint8_t i = 0; i < numBytes; i++) {
printf(" %2X", data[i]);
Expand All @@ -73,22 +73,22 @@ void PN532::PrintHexChar(const uint8_t *data, const uint32_t numBytes)
#ifdef ARDUINO
for (uint8_t i = 0; i < numBytes; i++) {
if (data[i] < 0x10) {
Serial.print(" 0");
SERIAL.print(" 0");
} else {
Serial.print(' ');
SERIAL.print(' ');
}
Serial.print(data[i], HEX);
SERIAL.print(data[i], HEX);
}
Serial.print(" ");
SERIAL.print(" ");
for (uint8_t i = 0; i < numBytes; i++) {
char c = data[i];
if (c <= 0x1f || c > 0x7f) {
Serial.print('.');
SERIAL.print('.');
} else {
Serial.print(c);
SERIAL.print(c);
}
}
Serial.println("");
SERIAL.println("");
#else
for (uint8_t i = 0; i < numBytes; i++) {
printf(" %2X", data[i]);
Expand Down
14 changes: 10 additions & 4 deletions PN532/PN532_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@

#include "Arduino.h"

#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE
#define SERIAL SerialUSB
#else
#define SERIAL Serial
#endif

#ifdef DEBUG
#define DMSG(args...) Serial.print(args)
#define DMSG_STR(str) Serial.println(str)
#define DMSG_HEX(num) Serial.print(' '); Serial.print((num>>4)&0x0F, HEX); Serial.print(num&0x0F, HEX)
#define DMSG_INT(num) Serial.print(' '); Serial.print(num)
#define DMSG(args...) SERIAL.print(args)
#define DMSG_STR(str) SERIAL.println(str)
#define DMSG_HEX(num) SERIAL.print(' '); SERIAL.print((num>>4)&0x0F, HEX); SERIAL.print(num&0x0F, HEX)
#define DMSG_INT(num) SERIAL.print(' '); SERIAL.print(num)
#else
#define DMSG(args...)
#define DMSG_STR(str)
Expand Down
4 changes: 2 additions & 2 deletions PN532_SWHSU/PN532_SWHSU.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#include "PN532_SWHSU.h"
#include "PN532_debug.h"
#include "PN532/PN532_SWHSU/PN532_SWHSU.h"
#include "PN532/PN532/PN532_debug.h"


PN532_SWHSU::PN532_SWHSU(SoftwareSerial &serial)
Expand Down
2 changes: 1 addition & 1 deletion PN532_SWHSU/PN532_SWHSU.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <SoftwareSerial.h>

#include "PN532Interface.h"
#include "PN532/PN532/PN532Interface.h"
#include "Arduino.h"

#define PN532_SWHSU_DEBUG
Expand Down

0 comments on commit f9c62da

Please sign in to comment.