Suga Koubou 製 PS_PADライブラリ https://developer.mbed.org/users/okini3939/code/PS_PAD/ を改造したもの。単に__rbitが使えなかったので置き換えただけ。
Dependents: pscontroller project_beta
Fork of PS_PAD by
PS_PAD.h
- Committer:
- miyakkey
- Date:
- 2017-03-19
- Revision:
- 2:14f34d92a797
- Parent:
- 1:840370e1dcce
- Child:
- 3:f5eee5325eed
File content as of revision 2:14f34d92a797:
/* * 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, BUTTONS, 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; uint8_t _pad[6]; int _vib1, _vib2; bool _connected; int send (const char *cmd, int len, char *dat); unsigned int bitflip32(unsigned int val); };