GPIO SPI

I’m trying to modify a raspberry pi code to work on the jetson. The code works to write onto an Adafruit LED screen.

The existing code

import time

import Adafruit_GPIO.SPI as SPI
import Adafruit_SSD1306

from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont

import subprocess

Raspberry Pi pin configuration:

RST = 24

Note the following are only used with SPI:

DC = 23
SPI_PORT = 0
SPI_DEVICE = 0

128x32 display with hardware I2C:

disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST)

I’ve modified

import time

import Adafruit_GPIO.SPI as SPI
import Adafruit_SSD1306

from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont

import subprocess

Raspberry Pi pin configuration:

RST = 24

Note the following are only used with SPI:

DC = 23
SPI_PORT = 0
SPI_DEVICE = 0

128x32 display with hardware I2C:

disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST)

disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST, i2c_bus=1, gpio=1) # setting gpio to 1 is hack to avoid platform detection

The issue lies in the GPIO library…I don’t think I really understand how the jetson’s works.

File “/home/jetson/EDITH/screen.py”, line 21, in
disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST, i2c_bus=1, gpio=1) # setting gpio to 1 is hack to avoid platform detection
File “/usr/local/lib/python3.6/dist-packages/Adafruit_SSD1306/SSD1306.py”, line 288, in init
gpio, spi, i2c_bus, i2c_address, i2c)
File “/usr/local/lib/python3.6/dist-packages/Adafruit_SSD1306/SSD1306.py”, line 89, in init
self._gpio.setup(self._rst, GPIO.OUT)
AttributeError: ‘int’ object has no attribute ‘setup’

hello vondalej,

assume you would like to control a 40 pin GPIO header (J41) for digital input and output.
please refer to Jetson.GPIO for the samples of how to configure the system and run the provided sample applications, and the library API.
thanks