Skip to content

Commit

Permalink
Merge pull request guyc#14 from JokerQyou/master
Browse files Browse the repository at this point in the history
Fix platform detection in samples
  • Loading branch information
guyc committed Dec 12, 2015
2 parents 7dee9b0 + ba285d0 commit 826d1c6
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 34 deletions.
25 changes: 12 additions & 13 deletions samples/capswitch_test.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import gaugette.platform
import gaugette.capswitch
import gaugette.rgbled
import time

if gaugette.platform == 'raspberrypi':
SWITCH_PIN = 9
RGB_RED = 6
RGB_GREEN = 5
RGB_BLUE = 4
if gaugette.platform.isRaspberryPi:
SWITCH_PIN = 9
RGB_RED = 6
RGB_GREEN = 5
RGB_BLUE = 4
else: # beaglebone
SWITCH_PIN = 'P9_X'
RGB_RED = 'P9_X'
RGB_GREEN = 'P9_X'
RGB_BLUE = 'P9_X'
raise NotImplementedError('capswitch is not yet supported on the beaglebone')
SWITCH_PIN = 'P9_X'
RGB_RED = 'P9_X'
RGB_GREEN = 'P9_X'
RGB_BLUE = 'P9_X'
raise NotImplementedError('capswitch is not yet supported on the beaglebone')

switch = gaugette.capswitch.CapSwitch(SWITCH_PIN)
led = gaugette.rgbled.RgbLed(RGB_RED, RGB_GREEN, RGB_BLUE)

Expand All @@ -30,4 +30,3 @@
else:
led.fade(0,0,100)
led_on = True

16 changes: 8 additions & 8 deletions samples/font_test.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import gaugette.ssd1306
import gaugette.platform
import time
import sys

ROWS = 32 # set to 64 for 128x64 display
if gaugette.platform == 'raspberrypi':
RESET_PIN = 15
DC_PIN = 16
if gaugette.platform.isRaspberryPi:
RESET_PIN = 15
DC_PIN = 16
else: # beagebone
RESET_PIN = "P9_15"
DC_PIN = "P9_13"
RESET_PIN = "P9_15"
DC_PIN = "P9_13"

fonts = []

Expand Down Expand Up @@ -70,7 +70,7 @@
textSize = led.draw_text3(0,row+y,font.name,font)
if textSize > 256:
textSize = 256

led.display()

for scroll in range(0,32):
Expand All @@ -90,7 +90,7 @@
led.display()
else:
time.sleep(1.0)

#row = (offset+32) % 64
#led.clear_block(0,row,128,32)
#led.draw_text3(-scroll,row+y,font.name,font)
Expand Down
5 changes: 2 additions & 3 deletions samples/oauth_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import gaugette.oauth
import datetime
import gdata.service
import sys

CLIENT_ID = 'your client_id here'
CLIENT_SECRET = 'your client secret here'
Expand All @@ -24,7 +23,7 @@
worksheets_feed = gd_client.GetWorksheetsFeed(spreadsheet_id)
else:
raise

worksheet_id = worksheets_feed.entry[0].id.text.rsplit('/',1)[1]

now = datetime.datetime.now().isoformat(' ')
Expand All @@ -44,4 +43,4 @@
else:
raise

print "done"
print "done"
1 change: 0 additions & 1 deletion samples/rgbled_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@
led.fade(100,0,0,500)
time.sleep(1)
led.fade(0,0,0,500)

3 changes: 2 additions & 1 deletion samples/rotary_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
# 1 1 3 2 1 0
# 0 1 2 3 1 0

import gaugette.platform
import gaugette.rotary_encoder
import gaugette.switch
import math

if gaugette.platform == 'raspberrypi':
if gaugette.platform.isRaspberryPi:
A_PIN = 7
B_PIN = 9
SW_PIN = 8
Expand Down
1 change: 0 additions & 1 deletion samples/rotary_worker_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@
if sw_state != last_state:
print ("switch %d" % sw_state)
last_state = sw_state

14 changes: 7 additions & 7 deletions samples/ssd1306_test.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import gaugette.ssd1306
import gaugette.platform
import time
import sys

ROWS = 32

if gaugette.platform == 'raspberrypi':
RESET_PIN = 15
DC_PIN = 16
if gaugette.platform.isRaspberryPi:
RESET_PIN = 15
DC_PIN = 16
else: # beagebone
RESET_PIN = "P9_15"
DC_PIN = "P9_13"
RESET_PIN = "P9_15"
DC_PIN = "P9_13"

print("init")
led = gaugette.ssd1306.SSD1306(reset_pin=RESET_PIN, dc_pin=DC_PIN, rows=ROWS, cols=128)
Expand Down Expand Up @@ -44,7 +44,7 @@
time.sleep(0.2)
else:
time.sleep(0.5)

# vertically scroll to switch between buffers
print("scroll")
for i in range(0,32):
Expand Down

0 comments on commit 826d1c6

Please sign in to comment.