Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for PIC32 return types #230

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MFRC522.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ MFRC522::StatusCode MFRC522::PCD_MIFARE_Transceive( byte *sendData, ///< Pointe
*
* @return const __FlashStringHelper *
*/
const __FlashStringHelper *MFRC522::GetStatusCodeName(MFRC522::StatusCode code ///< One of the StatusCode enums.
CCRET *MFRC522::GetStatusCodeName(MFRC522::StatusCode code ///< One of the StatusCode enums.
) {
switch (code) {
case STATUS_OK: return F("Success.");
Expand Down Expand Up @@ -1253,7 +1253,7 @@ MFRC522::PICC_Type MFRC522::PICC_GetType(byte sak ///< The SAK byte returned fr
*
* @return const __FlashStringHelper *
*/
const __FlashStringHelper *MFRC522::PICC_GetTypeName(PICC_Type piccType ///< One of the PICC_Type enums.
CCRET *MFRC522::PICC_GetTypeName(PICC_Type piccType ///< One of the PICC_Type enums.
) {
switch (piccType) {
case PICC_TYPE_ISO_14443_4: return F("PICC compliant with ISO/IEC 14443-4");
Expand Down
10 changes: 8 additions & 2 deletions MFRC522.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@
#include <Arduino.h>
#include <SPI.h>

#ifdef __PIC32__
#define CCRET const char
#else
#define CCRET const __FlashStringHelper
#endif

// Firmware data for self-test
// Reference values based on firmware version
// Hint: if needed, you can remove unused self-test data to save flash memory
Expand Down Expand Up @@ -381,11 +387,11 @@ class MFRC522 {
StatusCode PCD_MIFARE_Transceive(byte *sendData, byte sendLen, bool acceptTimeout = false);
// old function used too much memory, now name moved to flash; if you need char, copy from flash to memory
//const char *GetStatusCodeName(byte code);
static const __FlashStringHelper *GetStatusCodeName(StatusCode code);
static CCRET *GetStatusCodeName(StatusCode code);
static PICC_Type PICC_GetType(byte sak);
// old function used too much memory, now name moved to flash; if you need char, copy from flash to memory
//const char *PICC_GetTypeName(byte type);
static const __FlashStringHelper *PICC_GetTypeName(PICC_Type type);
static CCRET *PICC_GetTypeName(PICC_Type type);

// Support functions for debuging
void PCD_DumpVersionToSerial();
Expand Down