diff --git a/PS4BT.h b/PS4BT.h index 129df6b1..85d70f48 100644 --- a/PS4BT.h +++ b/PS4BT.h @@ -86,7 +86,6 @@ protected: }; /**@}*/ -private: /** @name PS4Parser implementation */ virtual void sendOutputReport(PS4Output *output) { // Source: https://github.com/chrippa/ds4drv uint8_t buf[79]; @@ -115,10 +114,7 @@ private: }; /**@}*/ - void HID_Command(uint8_t *data, uint8_t nbytes) { - pBtd->L2CAP_Command(hci_handle, data, nbytes, control_scid[0], control_scid[1]); - }; - +private: void enable_sixaxis() { // Command used to make the PS4 controller send out the entire output report uint8_t buf[2]; buf[0] = 0x43; // HID BT Get_report (0x40) | Report Type (Feature 0x03) @@ -127,6 +123,10 @@ private: HID_Command(buf, 2); }; + void HID_Command(uint8_t *data, uint8_t nbytes) { + pBtd->L2CAP_Command(hci_handle, data, nbytes, control_scid[0], control_scid[1]); + }; + void (*pFuncOnInit)(void); // Pointer to function called in onInit() }; #endif \ No newline at end of file diff --git a/PS4Parser.h b/PS4Parser.h index 680edc83..acde9a65 100644 --- a/PS4Parser.h +++ b/PS4Parser.h @@ -215,7 +215,7 @@ public: * @return Return the angle in the range of 0-360. */ double getAngle(AngleEnum a) { - if(a == Pitch) + if (a == Pitch) return (atan2(ps4Data.accY, ps4Data.accZ) + PI) * RAD_TO_DEG; else return (atan2(ps4Data.accX, ps4Data.accZ) + PI) * RAD_TO_DEG; @@ -349,7 +349,11 @@ protected: ps4Output.reportChanged = false; }; - virtual void sendOutputReport(PS4Output *output) = 0; // This is overridden in PS4BT and PS4USB + /** + * Send the output to the PS4 controller. This is implemented in PS4BT.h and PS4USB.h. + * @param output Pointer to PS4Output buffer; + */ + virtual void sendOutputReport(PS4Output *output) = 0; private: bool checkDpad(ButtonEnum b); // Used to check PS4 DPAD buttons diff --git a/PS4USB.h b/PS4USB.h index d377b60d..019ea930 100644 --- a/PS4USB.h +++ b/PS4USB.h @@ -86,7 +86,6 @@ protected: }; /**@}*/ -private: /** @name PS4Parser implementation */ virtual void sendOutputReport(PS4Output *output) { // Source: https://github.com/chrippa/ds4drv uint8_t buf[32]; @@ -113,6 +112,7 @@ private: }; /**@}*/ +private: void (*pFuncOnInit)(void); // Pointer to function called in onInit() }; #endif \ No newline at end of file