Skip to content

Commit

Permalink
Fix swap() references
Browse files Browse the repository at this point in the history
  • Loading branch information
PaintYourDragon committed Jan 26, 2016
1 parent caab84e commit 4f8e8f4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions Adafruit_SharpMem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ All text above, and the splash screen must be included in any redistribution

#include "Adafruit_SharpMem.h"

#ifndef _swap_int16_t
#define _swap_int16_t(a, b) { int16_t t = a; a = b; b = t; }
#endif
#ifndef _swap_uint16_t
#define _swap_uint16_t(a, b) { uint16_t t = a; a = b; b = t; }
#endif

/**************************************************************************
Sharp Memory Display Connector
-----------------------------------------------------------------------
Expand Down Expand Up @@ -161,15 +168,15 @@ void Adafruit_SharpMem::drawPixel(int16_t x, int16_t y, uint16_t color)

switch(rotation) {
case 1:
swap(x, y);
_swap_int16_t(x, y);
x = WIDTH - 1 - x;
break;
case 2:
x = WIDTH - 1 - x;
y = HEIGHT - 1 - y;
break;
case 3:
swap(x, y);
_swap_int16_t(x, y);
y = HEIGHT - 1 - y;
break;
}
Expand Down Expand Up @@ -201,15 +208,15 @@ uint8_t Adafruit_SharpMem::getPixel(uint16_t x, uint16_t y)

switch(rotation) {
case 1:
swap(x, y);
_swap_uint16_t(x, y);
x = WIDTH - 1 - x;
break;
case 2:
x = WIDTH - 1 - x;
y = HEIGHT - 1 - y;
break;
case 3:
swap(x, y);
_swap_uint16_t(x, y);
y = HEIGHT - 1 - y;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Adafruit SHARP Memory Display
version=1.0.1
version=1.0.2
author=Adafruit
maintainer=Adafruit <[email protected]>
sentence=This is an Arduino library for the Adafruit Monochrome SHARP Memory Displays
Expand Down

0 comments on commit 4f8e8f4

Please sign in to comment.