Permalink
Browse files

Patch for Arduino DUE

  • Loading branch information...
JiapengLi
JiapengLi committed Mar 19, 2013
1 parent 36e32e5 commit 69e355325312a57412d8c4d0ec6298aa3b4ed917
Showing with 23 additions and 4 deletions.
  1. +11 −2 Adafruit_GFX.cpp
  2. +12 −2 glcdfont.c
View
@@ -15,8 +15,9 @@
#include "Adafruit_GFX.h"
#include "glcdfont.c"
#ifndef __SAM3X8E__
#include <avr/pgmspace.h>
#endif
void Adafruit_GFX::constructor(int16_t w, int16_t h) {
_width = WIDTH = w;
_height = HEIGHT = h;
@@ -338,7 +339,11 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y,
for(j=0; j<h; j++) {
for(i=0; i<w; i++ ) {
#ifdef __SAM3X8E__
if( (*(bitmap + j * byteWidth + i / 8)) & (128 >> (i & 7))) {
#else
if(pgm_read_byte(bitmap + j * byteWidth + i / 8) & (128 >> (i & 7))) {
#endif
drawPixel(x+i, y+j, color);
}
}
@@ -384,8 +389,12 @@ void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c,
if (i == 5)
line = 0x0;
else
#ifdef __SAM3X8E__
line = *(font+(c*5)+i);
#else
line = pgm_read_byte(font+(c*5)+i);
for (int8_t j = 0; j<8; j++) {
#endif
for (int8_t j = 0; j<8; j++) {
if (line & 0x1) {
if (size == 1) // default size
drawPixel(x+i, y+j, color);
View
@@ -1,12 +1,22 @@
#ifdef __SAM3X8E__
#else
#include <avr/io.h>
#include <avr/pgmspace.h>
#endif
#ifndef FONT5X7_H
#define FONT5X7_H
// standard ascii 5x7 font
// START: top left(LSB of frist byte),
// END bottom right(MSB of last byte)
// DIR: top left --> bottom left
#ifdef __SAM3X8E__
const unsigned char font[] = {
#else
static unsigned char font[] PROGMEM = {
#endif
0x00, 0x00, 0x00, 0x00, 0x00,
0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
0x3E, 0x6B, 0x4F, 0x6B, 0x3E,

0 comments on commit 69e3553

Please sign in to comment.