Skip to main content

Python interface for GameSir T1d controller with pygame compatibility

Project description

GameSir T1d Pygame Wrapper

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

gamesir_t1d-0.1.1.tar.gz (34.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gamesir_t1d-0.1.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file gamesir_t1d-0.1.1.tar.gz.

File metadata

  • Download URL: gamesir_t1d-0.1.1.tar.gz
  • Upload date:
  • Size: 34.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.1

File hashes

Hashes for gamesir_t1d-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b7ea81cae51a53aef18faa3d8898fdb4cd365cfb14e8f064560b3b2d88d948aa
MD5 596fd6006032f4fdcb97525493947113
BLAKE2b-256 d0d951c12b2b0ea6a6d727bd6b89763d3cb05d6594a95be896a65ac42754ad12

See more details on using hashes here.

File details

Details for the file gamesir_t1d-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for gamesir_t1d-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 231fd4a594afd4706f0c8eb4f45a8903fd7b6a86b1a52a11ab97f38e281e180c
MD5 6030d04ff2e6c8a91e22d4015e17c163
BLAKE2b-256 c9622320ccdf7467e59f294dc78d8afed9ad794a1a8ff627c83f937b2c3fe0c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page