mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Removed some unnecessary functions and some other cleanup
This commit is contained in:
parent
08abfd4268
commit
7806212132
5 changed files with 9 additions and 26 deletions
|
@ -190,7 +190,7 @@ void BTHID::ACLData(uint8_t* l2capinbuf) {
|
||||||
#endif
|
#endif
|
||||||
if(l2capinbuf[8] == 0xA1) { // HID_THDR_DATA_INPUT
|
if(l2capinbuf[8] == 0xA1) { // HID_THDR_DATA_INPUT
|
||||||
uint16_t length = ((uint16_t)l2capinbuf[5] << 8 | l2capinbuf[4]);
|
uint16_t length = ((uint16_t)l2capinbuf[5] << 8 | l2capinbuf[4]);
|
||||||
ParseBTHID(this, (uint8_t)(length - 1), &l2capinbuf[9]);
|
ParseBTHIDData((uint8_t)(length - 1), &l2capinbuf[9]);
|
||||||
|
|
||||||
switch(l2capinbuf[9]) {
|
switch(l2capinbuf[9]) {
|
||||||
case 0x01: // Keyboard or Joystick events
|
case 0x01: // Keyboard or Joystick events
|
||||||
|
|
3
BTHID.h
3
BTHID.h
|
@ -109,11 +109,10 @@ protected:
|
||||||
/** @name Overridable functions */
|
/** @name Overridable functions */
|
||||||
/**
|
/**
|
||||||
* Used to parse Bluetooth HID data to any class that inherits this class.
|
* Used to parse Bluetooth HID data to any class that inherits this class.
|
||||||
* @param bthid Pointer to this class.
|
|
||||||
* @param len The length of the incoming data.
|
* @param len The length of the incoming data.
|
||||||
* @param buf Pointer to the data buffer.
|
* @param buf Pointer to the data buffer.
|
||||||
*/
|
*/
|
||||||
virtual void ParseBTHID(BTHID *bthid, uint8_t len, uint8_t *buf) {
|
virtual void ParseBTHIDData(uint8_t len, uint8_t *buf) {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
/** Called when a device is connected */
|
/** Called when a device is connected */
|
||||||
|
|
14
PS4BT.h
14
PS4BT.h
|
@ -46,14 +46,6 @@ public:
|
||||||
return BTHID::connected;
|
return BTHID::connected;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to call your own function when the device is successfully initialized.
|
|
||||||
* @param funcOnInit Function to call.
|
|
||||||
*/
|
|
||||||
void attachOnInit(void (*funcOnInit)(void)) {
|
|
||||||
pFuncOnInit = funcOnInit;
|
|
||||||
};
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** @name BTHID implementation */
|
/** @name BTHID implementation */
|
||||||
/**
|
/**
|
||||||
|
@ -62,7 +54,7 @@ protected:
|
||||||
* @param len The length of the incoming data.
|
* @param len The length of the incoming data.
|
||||||
* @param buf Pointer to the data buffer.
|
* @param buf Pointer to the data buffer.
|
||||||
*/
|
*/
|
||||||
virtual void ParseBTHID(BTHID *bthid, uint8_t len, uint8_t *buf) {
|
virtual void ParseBTHIDData(uint8_t len, uint8_t *buf) {
|
||||||
PS4Parser::Parse(len, buf);
|
PS4Parser::Parse(len, buf);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,8 +65,6 @@ protected:
|
||||||
*/
|
*/
|
||||||
virtual void OnInitBTHID() {
|
virtual void OnInitBTHID() {
|
||||||
enable_sixaxis(); // Make the controller send out the entire output report
|
enable_sixaxis(); // Make the controller send out the entire output report
|
||||||
if (pFuncOnInit)
|
|
||||||
pFuncOnInit(); // Call the user function
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used to reset the different buffers to there default values */
|
/** Used to reset the different buffers to there default values */
|
||||||
|
@ -84,8 +74,6 @@ protected:
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void (*pFuncOnInit)(void); // Pointer to function called in onInit()
|
|
||||||
|
|
||||||
void HID_Command(uint8_t *data, uint8_t nbytes) {
|
void HID_Command(uint8_t *data, uint8_t nbytes) {
|
||||||
pBtd->L2CAP_Command(hci_handle, data, nbytes, control_scid[0], control_scid[1]);
|
pBtd->L2CAP_Command(hci_handle, data, nbytes, control_scid[0], control_scid[1]);
|
||||||
};
|
};
|
||||||
|
|
|
@ -73,15 +73,11 @@ union PS4Buttons {
|
||||||
|
|
||||||
struct touchpadXY {
|
struct touchpadXY {
|
||||||
uint8_t dummy; // I can not figure out what this data is for, it seems to change randomly, maybe a timestamp?
|
uint8_t dummy; // I can not figure out what this data is for, it seems to change randomly, maybe a timestamp?
|
||||||
struct {
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t counter : 7; // Increments every time a finger is touching the touchpad
|
uint8_t counter : 7; // Increments every time a finger is touching the touchpad
|
||||||
uint8_t touching : 1; // The top bit is cleared if the finger is touching the touchpad
|
uint8_t touching : 1; // The top bit is cleared if the finger is touching the touchpad
|
||||||
};
|
|
||||||
struct {
|
|
||||||
uint16_t x : 12;
|
uint16_t x : 12;
|
||||||
uint16_t y : 12;
|
uint16_t y : 12;
|
||||||
};
|
|
||||||
} finger[2]; // 0 = first finger, 1 = second finger
|
} finger[2]; // 0 = first finger, 1 = second finger
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue