Skip to content

Latest commit

 

History

History
27 lines (17 loc) · 1.53 KB

README.md

File metadata and controls

27 lines (17 loc) · 1.53 KB

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