]> sigrok.org Git - libsigrokdecode.git/blame - decoders/nes_gamepad/__init__.py
ntf905: Add/rename required self.reset() method.
[libsigrokdecode.git] / decoders / nes_gamepad / __init__.py
CommitLineData
45c39fc4
ST
1##
2## This file is part of the libsigrokdecode project.
3##
4## Copyright (C) 2019 Stephan Thiele <stephan.thiele@mailbox.org>
5##
6## This program is free software; you can redistribute it and/or modify
7## it under the terms of the GNU General Public License as published by
8## the Free Software Foundation; either version 2 of the License, or
9## (at your option) any later version.
10##
11## This program is distributed in the hope that it will be useful,
12## but WITHOUT ANY WARRANTY; without even the implied warranty of
13## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14## GNU General Public License for more details.
15##
16## You should have received a copy of the GNU General Public License
17## along with this program; if not, see <http://www.gnu.org/licenses/>.
18##
19
20'''
21This decoder stacks on top of the 'spi' PD and decodes the button states
22of an NES gamepad.
23
24The SPI decoder needs to be configured as follows:
25
26Clock polarity = 1
27Clock phase = 0
28Bit order = msb-first
29Word size = 8
30
31Chip-select is not used and must not be assigned to any channel.
32
33Hardware setup is as follows:
34 ___
35 GND |o \
36 CUP |o o| VCC
37 OUT 0 |o o| D3
38 D1 |o o| D4
39 -----
40NES Gamepad Connector
41
42VCC - Power 5V
43GND - Ground
44CUP - Shift register clock (CLK)
45OUT 0 - Shift register latch (optional)
46D1 - Gamepad data (MOSI)
47D3 - Data (unused)
48D4 - Data (unused)
49
50Data pins D3 and D4 are not used by the standard gamepad but
51by special controllers like the Nintento Zapper light gun.
52'''
53
54from .pd import Decoder