Python interface for GameSir T1d controller with pygame compatibility
Project description
GameSir T1d Pygame Wrapper
A Python package that provides a Pygame-compatible interface for the GameSir T1d controller, making it easy to use in Pygame applications. This package handles BLE connections, reconnections, and provides a convenient API.
Features
- Bluetooth Low Energy (BLE) connection to GameSir T1d controllers
- Automatic reconnection handling
- Pygame-compatible interface for easy integration
- Raw controller data access
- Mapped buttons and axes with proper normalization
- BLE scanner tool to discover controller names
Installation
pip install gamesir-t1d
Or with uv:
uv add gamesir-t1d
Finding Your Controller Name
Before using the package, you need to know your controller's exact name. Each GameSir T1d controller broadcasts with a name like "Gamesir-T1d-XXXX" where XXXX is a unique identifier.
Use the included scanner tool to discover your controller:
# After installing the package
gamesir-scan
Make sure your controller is turned on and in pairing mode (typically hold the power button until LEDs flash rapidly). The scanner will show all discovered Bluetooth devices and try to identify GameSir controllers.
The scanner has additional options:
# Skip the "Press Enter" prompt and start scanning immediately
gamesir-scan --no-prompt
# Adjust the scan timeout (in seconds)
gamesir-scan --timeout 5.0
# Get help on available options
gamesir-scan --help
Basic Usage
from gamesir_t1d import GameSirT1dPygame
# Create the controller object with your controller's name
controller = GameSirT1dPygame("Gamesir-T1d-XXXX") # Replace XXXX with your controller ID
# Initialize the controller (starts BLE connection)
controller.init()
# Read axes and buttons using the pygame-compatible interface
left_x = controller.get_axis(0) # Range: -1.0 to 1.0
left_y = controller.get_axis(1) # Range: -1.0 to 1.0
a_button = controller.get_button(0) # 1 for pressed, 0 for not pressed
# Check if the controller is connected
if controller.is_connected():
print("Controller is connected!")
# Clean up when done
controller.quit()
Pygame Example
The package includes an example Pygame application that demonstrates how to use the controller:
# Assuming you've installed the package with the [examples] extra
# pip install gamesir-t1d[examples]
from gamesir_t1d.examples import run
# Run the demo
run("Gamesir-T1d-XXXX") # Replace XXXX with your controller ID
License
MIT License - see the LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gamesir_t1d-0.1.2.tar.gz.
File metadata
- Download URL: gamesir_t1d-0.1.2.tar.gz
- Upload date:
- Size: 34.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91c484cd704ece737ca13218f97f79d7c944ebdee0f6a03c875bea923037fc87
|
|
| MD5 |
622d035b84c384e0bf00efe097e06294
|
|
| BLAKE2b-256 |
9a9be7598f763d2759f3c505b2fdc28cb06838dbf03cce0dc4533ea36950a928
|
File details
Details for the file gamesir_t1d-0.1.2-py3-none-any.whl.
File metadata
- Download URL: gamesir_t1d-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2ec449c2e847520ea934df6242b1f0142587f28e87176556399cdd6ac8e926e
|
|
| MD5 |
15fdd9ef9d32b74bb3f53cfe712826b4
|
|
| BLAKE2b-256 |
a4ad13c1a1b015f1c4c4dfc1b92a9b50beb293197644ce9784e8102ddebefa0c
|