mihai-dinculescu / micropython-adafruit-drivers

This is a collection of lightweight MicroPython drivers for Adafruit sensors and modules.
MIT License
6 stars 1 forks source link

Used your seesaw driver for I2C connection between Pimoroni Inky Frame 5.7 and Adafruit Gamepad QT #1

Open PaulskPt opened 8 months ago

PaulskPt commented 8 months ago

Hi Mihai, Since, until now, I didn't find a means to contact you, I created this issue. You wrote in the README.md that you are open for collaborations. I want to give you feedback, to let you know that your repo with your version of the Adafruit seesaw module, solved a problem I faced! I was trying to port that Adafruit seesaw module (written for Circuitpython) to Micropython. I want to inform you that the past two weeks or so I struggled (and didn't succeed) to have a Pimoroni Inkey Frame 5.7 to communicate via I2C with an Adafruit Gamepad QT. Somewhere I have an error in the script because I2C.scan() reported the Gamepad QT however i2c.write or i2c.read calls resulted in errors. Yesterday, when studying certain files of Pimoroni's Github repo Pimoroni-pico I came across an (undocumented?) inky-frame.i2c module function which I now use. Before I already had the Gamepad QT communicating with an Adafruit ESP32-S2 TFT using Circuitpython V9.

Yesterday I googled again for a solution, then I found this repo from you. I copied some parts of the original adafruit seesaw library that I needed into your version and tailored the resulting script for only the Gamepad QT. It worked! See the Shell output below:

Thursday 2024-02-08 00h43 utc

Board: Pimoroni Inky Frame 5.7
Flashed with: 
MicroPython v1.21.0, inky_frame v1.21.0 on 2023-10-06; Raspberry Pi Pico W with RP2040

and via I2C connected: an Adafruit Gamepad QT (ID 5743)

IDE: Thonny

Shell Output:

>>> %Run -c $EDITOR_CONTENT
File: boot.py: SD card mounted at "/sd"
USB power!
gamepad_test(): seesaw._chip_id()= 0x87 hex
gamepad_test(): We're going to test the gamepad.
gamepad_test(): Press button A, B, X, Y, 'Select' or 'Start' on Gamepad Qt
Joystick: (x, y): 504,507
Joystick: (x, y): 504,1023
Joystick: (x, y): 504,511
Joystick: (x, y): 504,489
Joystick: (x, y): 504,495
Joystick: (x, y): 1023,308
Joystick: (x, y): 504,495
Joystick: (x, y): 504,0
Joystick: (x, y): 509,511
Joystick: (x, y): 831,383
Joystick: (x, y): 504,492
Joystick: (x, y): 504,498
Joystick: (x, y): 504,504
Button B pressed
Button A pressed
Button X pressed
Button Y pressed
Button Select pressed
Button Start pressed

Thank you for publishing this repo!

PaulskPt commented 7 months ago

Published my repo: Inky Frame Image Display with Gamepad QT