clarify SetStateData func

This commit is contained in:
awalol
2026-05-09 14:29:35 +08:00
parent bb1c8f4a97
commit ec2b1dbc12
3 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -40,7 +40,7 @@ struct audio_raw_element {
float data[512 * 2];
};
uint8_t interrupt_out_data[63] = {
uint8_t state_data[63] = {
0xfd, 0xf7, 0x0, 0x0,
0x7f, 0x7f, // Headphones, Speaker
0xff, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
@@ -52,8 +52,8 @@ uint8_t interrupt_out_data[63] = {
0xff, 0xd7, 0x00, // RGB LED: R, G, B (Nijika Color!)✨
};
void set_interrupt_out_data(const uint8_t* data, const uint8_t len) {
memcpy(interrupt_out_data, data, len);
void set_state_data(const uint8_t* data, const uint8_t len) {
memcpy(state_data, data, len);
}
void set_headset(bool state) {
@@ -133,7 +133,7 @@ void audio_loop() {
pkt[10] = packetCounter++;
pkt[11] = 0x10 | 0 << 6 | 1 << 7;
pkt[12] = 63;
memcpy(pkt + 13, interrupt_out_data, sizeof(interrupt_out_data));
memcpy(pkt + 13, state_data, sizeof(state_data));
pkt[76] = 0x12 | 0 << 6 | 1 << 7;
pkt[77] = SAMPLE_SIZE;
memcpy(pkt + 78, haptic_buf, SAMPLE_SIZE);
+1 -1
View File
@@ -11,6 +11,6 @@ void audio_init();
void audio_loop();
void core1_entry();
void set_headset(bool state);
void set_interrupt_out_data(const uint8_t* data, const uint8_t len);
void set_state_data(const uint8_t* data, const uint8_t len);
#endif //DS5_BRIDGE_AUDIO_H
+1 -1
View File
@@ -159,7 +159,7 @@ void tud_hid_set_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t rep
switch (buffer[0]) {
case 0x02: {
if (spk_active) {
set_interrupt_out_data(buffer + 1, bufsize - 1);
set_state_data(buffer + 1, bufsize - 1);
break;
}
uint8_t outputData[78];