dhustkoder / avrshock2

AVRSHOCK2 API: Use the PS2 Controller (DUALSHOCK 2) with AVR Microcontrollers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AVRSHOCK2

AVRSHOCK2 is a small API to use the PS2 Controller through AVR Microcontrollers. To use the AVRSHOCK2, just add the avrshock2.c and avrshock2.h files to your project.

makefile and example.c

The makefile builds an example of how to use the AVRSHOCK2 API by logging to serial port the pressed buttons, it was tested on Atmega328p (Arduino UNO board).

gif

Details

gif

AVRSHOCK2 uses 4 pins to communicate with the controller: ATT, CMD, DAT, CLK. If you use SPI Mode: SS = ATT, MOSI = CMD, MISO = DAT, SCK = CLK. You should set the PORT, DDR, BIT for them by defining: AVRSHOCK2_PORT_ATT, AVRCHOCK2_DDR_ATT, AVRSHOCK2_BIT_ATT etc... For DAT you should set the PIN also: AVRSHOCK2_PIN_DAT (see makefile). F_AVRSHOCK2 is the rate in hertz that the communication will be made, range (100000 - 500000). If not defined F_AVRSHOCK2 defaults to 250000.

Here is the circuit diagram to use AVRSHOCK2:

wiring diagram

About

AVRSHOCK2 API: Use the PS2 Controller (DUALSHOCK 2) with AVR Microcontrollers.

License:MIT License


Languages

Language:C 82.8%Language:Makefile 17.2%