diff --git a/_p_s5_b_t_8h_source.html b/_p_s5_b_t_8h_source.html index 659e11f6..4895a899 100644 --- a/_p_s5_b_t_8h_source.html +++ b/_p_s5_b_t_8h_source.html @@ -202,67 +202,65 @@ $(function() {
168  buf[0] = 0xA2; // HID BT DATA (0xA0) | Report Type (Output 0x02)
169 
170  buf[0x01] = 0x31; // Report ID
-
171  buf[0x02] = (output_sequence_counter << 4) | 0x0; // Highest 4-bit is a sequence number, which needs to be increased every report. Lowest 4-bit is tag and can be zero for now.
-
172  if(++output_sequence_counter == 15)
-
173  output_sequence_counter = 0;
-
174  buf[0x03] = 0x10; // Magic number must be set to 0x10
-
175 
-
176  buf[0x01 + 3] = 0xFF; // feature flags 1
-
177  buf[0x02 + 3]= 0xF7; // feature flags 2
-
178 
-
179  buf[0x03 + 3] = output->smallRumble; // Small Rumble
-
180  buf[0x04 + 3] = output->bigRumble; // Big rumble
+
171  buf[0x02] = (output_sequence_counter++ << 4) | 0x0; // Highest 4-bit is a sequence number, which needs to be increased every report. Lowest 4-bit is tag and can be zero for now.
+
172  buf[0x03] = 0x10; // Magic number must be set to 0x10
+
173 
+
174  buf[0x01 + 3] = 0xFF; // feature flags 1
+
175  buf[0x02 + 3]= 0xF7; // feature flags 2
+
176 
+
177  buf[0x03 + 3] = output->smallRumble; // Small Rumble
+
178  buf[0x04 + 3] = output->bigRumble; // Big rumble
+
179 
+
180  // 5-7 headphone, speaker, mic volume, audio flags
181 
-
182  // 5-7 headphone, speaker, mic volume, audio flags
+
182  buf[0x09 + 3] = (uint8_t)output->microphoneLed;
183 
-
184  buf[0x09 + 3] = (uint8_t)output->microphoneLed;
+
184  // 0x0A mute flags
185 
-
186  // 0x0A mute flags
-
187 
-
188  // Adaptive Triggers: 0x0B-0x14 right, 0x15 unknown, 0x16-0x1F left
-
189  rightTrigger.processTrigger(&buf[0x0B + 3]); // right
-
190  leftTrigger.processTrigger(&buf[0x16 + 3]); // left
-
191 
-
192  // 0x20-0x24 unknown
-
193  // 0x25 trigger motor effect strengths
-
194  // 0x26 speaker volume
-
195 
-
196  // player LEDs
-
197  buf[0x27 + 3] = 0x03; // led brightness, pulse
-
198  buf[0x2A + 3] = output->disableLeds ? 0x01 : 0x2; // led pulse option
-
199  // buf[0x2B] LED brightness, 0 = full, 1= medium, 2 = low
-
200  buf[0x2C + 3] = output->playerLeds; // 5 white player LEDs
-
201 
-
202  // lightbar
-
203  buf[0x2D + 3] = output->r; // Red
-
204  buf[0x2E + 3] = output->g; // Green
-
205  buf[0x2F + 3] = output->b; // Blue
-
206 
-
207  uint32_t crc = ~crc32(0xFFFFFFFF, buf, sizeof(buf) - 4 /* Do not include the crc32 */); // Note how the report type is also included in the output report
-
208  buf[75] = crc & 0xFF;
-
209  buf[76] = (crc >> 8) & 0xFF;
-
210  buf[77] = (crc >> 16);
-
211  buf[78] = (crc >> 24);
+
186  // Adaptive Triggers: 0x0B-0x14 right, 0x15 unknown, 0x16-0x1F left
+
187  rightTrigger.processTrigger(&buf[0x0B + 3]); // right
+
188  leftTrigger.processTrigger(&buf[0x16 + 3]); // left
+
189 
+
190  // 0x20-0x24 unknown
+
191  // 0x25 trigger motor effect strengths
+
192  // 0x26 speaker volume
+
193 
+
194  // player LEDs
+
195  buf[0x27 + 3] = 0x03; // led brightness, pulse
+
196  buf[0x2A + 3] = output->disableLeds ? 0x01 : 0x2; // led pulse option
+
197  // buf[0x2B] LED brightness, 0 = full, 1= medium, 2 = low
+
198  buf[0x2C + 3] = output->playerLeds; // 5 white player LEDs
+
199 
+
200  // lightbar
+
201  buf[0x2D + 3] = output->r; // Red
+
202  buf[0x2E + 3] = output->g; // Green
+
203  buf[0x2F + 3] = output->b; // Blue
+
204 
+
205  uint32_t crc = ~crc32(0xFFFFFFFF, buf, sizeof(buf) - 4 /* Do not include the crc32 */); // Note how the report type is also included in the output report
+
206  buf[75] = crc & 0xFF;
+
207  buf[76] = (crc >> 8) & 0xFF;
+
208  buf[77] = (crc >> 16);
+
209  buf[78] = (crc >> 24);
+
210 
+
211  output->reportChanged = false;
212 
-
213  output->reportChanged = false;
-
214 
-
215  // Send the Bluetooth DATA output report on the interrupt channel
-
216  pBtd->L2CAP_Command(hci_handle, buf, sizeof(buf), interrupt_scid[0], interrupt_scid[1]);
-
217  };
-
220 private:
-
221  void enable_sixaxis() { // Command used to make the PS5 controller send out the entire output report
-
222  // Request the paring info. This makes the controller send out the full report - see: https://patchwork.kernel.org/project/linux-input/cover/20201219062336.72568-1-roderick@gaikai.com/
-
223  uint8_t buf[2];
-
224  buf[0] = 0x43; // HID BT Get_report (0x40) | Report Type (Feature 0x03)
-
225  buf[1] = 0x09; // Report ID for paring info
-
226 
-
227  // Send the Bluetooth Get_report Feature report on the control channel
-
228  pBtd->L2CAP_Command(hci_handle, buf, 2, control_scid[0], control_scid[1]);
-
229  };
-
230 
-
231  uint8_t output_sequence_counter;
-
232 };
-
233 #endif
+
213  // Send the Bluetooth DATA output report on the interrupt channel
+
214  pBtd->L2CAP_Command(hci_handle, buf, sizeof(buf), interrupt_scid[0], interrupt_scid[1]);
+
215  };
+
218 private:
+
219  void enable_sixaxis() { // Command used to make the PS5 controller send out the entire output report
+
220  // Request the paring info. This makes the controller send out the full report - see: https://patchwork.kernel.org/project/linux-input/cover/20201219062336.72568-1-roderick@gaikai.com/
+
221  uint8_t buf[2];
+
222  buf[0] = 0x43; // HID BT Get_report (0x40) | Report Type (Feature 0x03)
+
223  buf[1] = 0x09; // Report ID for paring info
+
224 
+
225  // Send the Bluetooth Get_report Feature report on the control channel
+
226  pBtd->L2CAP_Command(hci_handle, buf, 2, control_scid[0], control_scid[1]);
+
227  };
+
228 
+
229  uint8_t output_sequence_counter;
+
230 };
+
231 #endif
PS5BT::sendOutputReport
virtual void sendOutputReport(PS5Output *output)
Definition: PS5BT.h:162
PS5Parser::rightTrigger
PS5Trigger rightTrigger
Definition: PS5Parser.h:157