Skip to content

Commit

Permalink
Correct usage for (weak) attribute callback functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mikalhart committed Oct 13, 2019
1 parent 520a74e commit aad7f99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/IridiumSBD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <time.h>
#include "IridiumSBD.h"

bool ISBDCallback() __attribute__((weak)) { return true; }
void ISBDConsoleCallback(IridiumSBD *device, char c) __attribute__((weak)) { }
void ISBDDiagsCallback(IridiumSBD *device, char c) __attribute__((weak)) { }

// Power on the RockBLOCK or return from sleep
int IridiumSBD::begin()
{
Expand Down Expand Up @@ -613,10 +617,7 @@ bool IridiumSBD::cancelled()
if (ringPin != -1 && digitalRead(ringPin) == LOW) // Active low per guide
ringAsserted = true;

if (ISBDCallback != NULL)
return !ISBDCallback();

return false;
return !ISBDCallback();
}

int IridiumSBD::doSBDIX(uint16_t &moCode, uint16_t &moMSN, uint16_t &mtCode, uint16_t &mtMSN, uint16_t &mtLen, uint16_t &mtRemaining)
Expand Down
4 changes: 0 additions & 4 deletions src/IridiumSBD.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,3 @@ class IridiumSBD
int filteredread();
};

extern bool ISBDCallback() __attribute__((weak));
extern void ISBDConsoleCallback(IridiumSBD *device, char c) __attribute__((weak));
extern void ISBDDiagsCallback(IridiumSBD *device, char c) __attribute__((weak));

0 comments on commit aad7f99

Please sign in to comment.