Skip to content

Commit

Permalink
Merge pull request #3 from BlitzCityDIY/main
Browse files Browse the repository at this point in the history
update example to check for raspberry pi
  • Loading branch information
BlitzCityDIY authored Jun 11, 2024
2 parents 36257b8 + 0717dac commit 240bc95
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions examples/ch9328_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@

import time
import board
import busio
from adafruit_ch9328.ch9328 import Adafruit_CH9328
from adafruit_ch9328.ch9328_keymap import Keymap

# Initialize UART for the CH9328
uart = busio.UART(board.TX, board.RX, baudrate=9600)
# check for Raspberry Pi
# pylint: disable=simplifiable-condition
if "CE0" and "CE1" in dir(board):
import serial

uart = serial.Serial("/dev/ttyS0", baudrate=9600, timeout=3000)
# otherwise use busio
else:
import busio

uart = busio.UART(board.TX, board.RX, baudrate=9600)
ch9328 = Adafruit_CH9328(uart)

# Wait for 2 seconds
Expand Down

0 comments on commit 240bc95

Please sign in to comment.