Skip to content
This repository was archived by the owner on Mar 23, 2019. It is now read-only.

Commit

Permalink
Added I2C support
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Dec 14, 2012
1 parent c19da72 commit e3c2e7c
Show file tree
Hide file tree
Showing 4 changed files with 217 additions and 169 deletions.
37 changes: 17 additions & 20 deletions adafruit/adafruitgfx.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#----------------------------------------------------------------------
# adafruitgfx.py from https://github.com/andig/AdaPi
# ported by Andreas Goetz, http://www.cpuidle.de
# adafruitgfx.py ported by Andreas Goetz, http://www.cpuidle.de
# https://github.com/andig/AdaPi
#
# This library is a pure-python port of the Adafruit GFX C library:
#
Expand Down Expand Up @@ -56,13 +56,13 @@ def draw_circle(self, x0, y0, r, color):

while (x<y):
if (f >= 0):
y-=1
y -=1
ddF_y += 2
f += ddF_y
f += ddF_y

x+=1
x +=1
ddF_x += 2
f += ddF_x
f += ddF_x

self.draw_pixel(x0 + x, y0 + y, color)
self.draw_pixel(x0 - x, y0 + y, color)
Expand All @@ -83,13 +83,13 @@ def draw_circle_helper(self, x0, y0, r, cornername, color):

while (x<y):
if (f >= 0):
y-=1
y -=1
ddF_y += 2
f += ddF_y

x +=1
x +=1
ddF_x += 2
f += ddF_x
f += ddF_x

if (cornername & 0x4):
self.draw_pixel(x0 + x, y0 + y, color)
Expand Down Expand Up @@ -341,8 +341,8 @@ def fill_triangle (self, x0, y0, x1, y1, x2, y2, color):
# def draw_char(self, x, y, unsigned char c, color, ubg, size):
# if ((x >= self._width) || # Clip right
# (y >= self._height) || # Clip bottom
# ((x + 5 * size - 1) < 0) || # Clip left
# ((y + 8 * size - 1) < 0)): # Clip top
# ((x + 5 * size - 1) < 0) || # Clip left
# ((y + 8 * size - 1) < 0)): # Clip top
# return
#
# for (i=0; i<6; i+=1)
Expand Down Expand Up @@ -393,14 +393,11 @@ def get_rotation(self):


def set_rotation(self, x):
x %= 4; # cant be higher than 3
self.rotation = x
if x in [0,2]:
self._width = WIDTH
self._height = HEIGHT
self.rotation = x % 4; # cant be higher than 3
if self.rotation % 2 == 0:
self._width, self._height = WIDTH, HEIGHT
else:
self._width = HEIGHT
self._height = WIDTH
self._width, self._height = HEIGHT, WIDTH


def invert_display(self, i):
Expand Down Expand Up @@ -430,8 +427,8 @@ def draw_text(self, x, y, string, size=1, space=1):
p = ord(c) * font_cols
for col in range(0,font_cols):
mask = font_bytes[p]
p+=1
py = y
p += 1
py = y
for row in range(0,8):
for sy in range(0,size):
px = x
Expand Down
Loading

0 comments on commit e3c2e7c

Please sign in to comment.