switch: Nintendo Switch Controller Library

[ bsd3, game, library ] [ Propose Tags ]

Please see the README on GitHub at https://github.com/typedbyte/switch#readme


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Change log ChangeLog.md
Dependencies attoparsec (>=0.13.2.0 && <0.14.0.0), base (>=4.7 && <5), bytestring (>=0.10.12.0 && <0.12.0.0), hidapi (>=0.1.6 && <0.2.0) [details]
License BSD-3-Clause
Copyright 2021 Michael Szvetits
Author Michael Szvetits
Maintainer typedbyte@qualified.name
Category Game
Home page https://github.com/typedbyte/switch#readme
Bug tracker https://github.com/typedbyte/switch/issues
Source repo head: git clone https://github.com/typedbyte/switch
Uploaded by MichaelSzvetits at 2021-03-31T18:33:00Z
Distributions
Downloads 165 total (4 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user [build log]
All reported builds failed as of 2021-03-31 [all 3 reports]

Readme for switch-0.1.0.0

[back to package description]

switch

Hackage

switch is a library for interacting with Nintendo Switch controllers, written in Haskell. It allows your application to detect controllers via Bluetooth, connect to them, read input (e.g., buttons, sensors) from them and sending commands (e.g., rumble) to them. Notable features of this library are:

  • Supports all popular controller types (left Joy-Con, right Joy-Con, Pro Controller).
  • Supports controller input: read button states, analog stick directions and battery information.
  • Supports controller output: send rumble commands, set player lights and configure the home light.
  • Supports position tracking of a controller using its accelerometer and gyroscope.
  • Provides a type-safe interface for controller interaction (e.g., trying to configure the home light of a controller which has no home light results in a compile error).

The communication protocol of the controllers is based on existing efforts of the reverse engineering community. The documentation of the library can be found on Hackage.

Usage

  1. Press and hold the SYNC button on your Nintendo Switch controller for a few seconds. It is the small black button on the side (Joy-Con) or top (Pro Controller) of the controller.
  2. Scan for Bluetooth devices on your computer. Depending on your controller, you should detect a device named Joy-Con (L), Joy-Con (R) or Pro Controller. Connect to it.
  3. Talk to the controller by developing and running an application that uses the switch library on your computer, or try one of the provided examples.

Compatibility

This library should work with Windows, Linux and macOS, but it was primarily tested under Windows 10.

Limitations and Remarks

The following features are not implemented yet:

  • Interacting with the NFC sensor of the right Joy-Con.
  • Interacting with the IR camera of the right Joy-Con.