Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: pscontroller project_beta
Fork of PS_PAD by
PS_PAD.h
- Committer:
- okini3939
- Date:
- 2013-12-11
- Revision:
- 0:6eeefcf5a37a
- Child:
- 1:840370e1dcce
File content as of revision 0:6eeefcf5a37a:
/*
* PlayStation Controller library
* Copyright (c) 2013 Hiroshi Suga
*/
#include "mbed.h"
class PS_PAD {
public:
enum TYPE {
PAD_LEFT,
PAD_BOTTOM,
PAD_RIGHT,
PAD_TOP,
PAD_START,
ANALOG_LEFT,
ANALOG_RIGHT,
PAD_SELECT,
PAD_SQUARE,
PAD_X,
PAD_CIRCLE,
PAD_TRIANGLE,
PAD_R1,
PAD_L1,
PAD_R2,
PAD_L2,
ANALOG_RX,
ANALOG_RY,
ANALOG_LX,
ANALOG_LY,
};
PS_PAD (PinName mosi, PinName miso, PinName sck, PinName cs);
PS_PAD (SPI &spi, PinName cs);
int init ();
int poll ();
int read (TYPE t);
int vibration (int v1, int v2);
private:
SPI _spi;
DigitalOut _cs;
char _pad[6];
int _vib1, _vib2;
int send (const char *cmd, int len, char *dat);
};
