diff options
| author | hathach <[email protected]> | 2020-10-07 13:36:03 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2020-10-07 13:36:03 +0700 |
| commit | 3f54c27afa39a3b9f2e5911b566416be460389fb (patch) | |
| tree | 7c94fcb2b6387895020af98ec5c3e5442f4bcc7f /examples | |
| parent | d41248900bedd705df2ccd5dfc53932cdb0839bb (diff) | |
fix audio_test build
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/device/audio_test/.skip.MCU_SAMD11 | 0 | ||||
| -rw-r--r-- | examples/device/audio_test/.skip.MCU_SAMG | 0 | ||||
| -rw-r--r-- | examples/device/audio_test/src/main.c | 44 | ||||
| -rw-r--r-- | examples/rules.mk | 1 |
4 files changed, 30 insertions, 15 deletions
diff --git a/examples/device/audio_test/.skip.MCU_SAMD11 b/examples/device/audio_test/.skip.MCU_SAMD11 new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/examples/device/audio_test/.skip.MCU_SAMD11 diff --git a/examples/device/audio_test/.skip.MCU_SAMG b/examples/device/audio_test/.skip.MCU_SAMG new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/examples/device/audio_test/.skip.MCU_SAMG diff --git a/examples/device/audio_test/src/main.c b/examples/device/audio_test/src/main.c index e55c64c7c..2ea1d36c6 100644 --- a/examples/device/audio_test/src/main.c +++ b/examples/device/audio_test/src/main.c @@ -137,6 +137,7 @@ void audio_task(void) bool tud_audio_set_req_ep_cb(uint8_t rhport, tusb_control_request_t const * p_request, uint8_t *pBuff) { (void) rhport; + (void) pBuff; // We do not support any set range requests here, only current value requests TU_VERIFY(p_request->bRequest == AUDIO_CS_REQ_CUR); @@ -146,6 +147,8 @@ bool tud_audio_set_req_ep_cb(uint8_t rhport, tusb_control_request_t const * p_re uint8_t ctrlSel = TU_U16_HIGH(p_request->wValue); uint8_t ep = TU_U16_LOW(p_request->wIndex); + (void) channelNum; (void) ctrlSel; (void) ep; + return false; // Yet not implemented } @@ -153,6 +156,7 @@ bool tud_audio_set_req_ep_cb(uint8_t rhport, tusb_control_request_t const * p_re bool tud_audio_set_req_itf_cb(uint8_t rhport, tusb_control_request_t const * p_request, uint8_t *pBuff) { (void) rhport; + (void) pBuff; // We do not support any set range requests here, only current value requests TU_VERIFY(p_request->bRequest == AUDIO_CS_REQ_CUR); @@ -162,6 +166,8 @@ bool tud_audio_set_req_itf_cb(uint8_t rhport, tusb_control_request_t const * p_r uint8_t ctrlSel = TU_U16_HIGH(p_request->wValue); uint8_t itf = TU_U16_LOW(p_request->wIndex); + (void) channelNum; (void) ctrlSel; (void) itf; + return false; // Yet not implemented } @@ -176,39 +182,43 @@ bool tud_audio_set_req_entity_cb(uint8_t rhport, tusb_control_request_t const * uint8_t itf = TU_U16_LOW(p_request->wIndex); uint8_t entityID = TU_U16_HIGH(p_request->wIndex); + (void) itf; + // We do not support any set range requests here, only current value requests TU_VERIFY(p_request->bRequest == AUDIO_CS_REQ_CUR); // If request is for our feature unit - if (entityID == 2) + if ( entityID == 2 ) { - switch (ctrlSel) + switch ( ctrlSel ) { case AUDIO_FU_CTRL_MUTE: - // Request uses format layout 1 - TU_VERIFY(p_request->wLength == sizeof(audio_control_cur_1_t)); + // Request uses format layout 1 + TU_VERIFY(p_request->wLength == sizeof(audio_control_cur_1_t)); - mute[channelNum] = ((audio_control_cur_1_t *)pBuff)->bCur; + mute[channelNum] = ((audio_control_cur_1_t*) pBuff)->bCur; - TU_LOG2(" Set Mute: %d of channel: %u\r\n", mute[channelNum], channelNum); + TU_LOG2(" Set Mute: %d of channel: %u\r\n", mute[channelNum], channelNum); - return true; + return true; case AUDIO_FU_CTRL_VOLUME: - // Request uses format layout 2 - TU_VERIFY(p_request->wLength == sizeof(audio_control_cur_2_t)); + // Request uses format layout 2 + TU_VERIFY(p_request->wLength == sizeof(audio_control_cur_2_t)); - volume[channelNum] = ((audio_control_cur_2_t *)pBuff)->bCur; + volume[channelNum] = ((audio_control_cur_2_t*) pBuff)->bCur; - TU_LOG2(" Set Volume: %d dB of channel: %u\r\n", volume[channelNum], channelNum); + TU_LOG2(" Set Volume: %d dB of channel: %u\r\n", volume[channelNum], channelNum); - return true; + return true; - // Unknown/Unsupported control - default: TU_BREAKPOINT(); return false; + // Unknown/Unsupported control + default: + TU_BREAKPOINT(); + return false; } } - return false; // Yet not implemented + return false; // Yet not implemented } // Invoked when audio class specific get request received for an EP @@ -221,6 +231,8 @@ bool tud_audio_get_req_ep_cb(uint8_t rhport, tusb_control_request_t const * p_re uint8_t ctrlSel = TU_U16_HIGH(p_request->wValue); uint8_t ep = TU_U16_LOW(p_request->wIndex); + (void) channelNum; (void) ctrlSel; (void) ep; + // return tud_control_xfer(rhport, p_request, &tmp, 1); return false; // Yet not implemented @@ -236,6 +248,8 @@ bool tud_audio_get_req_itf_cb(uint8_t rhport, tusb_control_request_t const * p_r uint8_t ctrlSel = TU_U16_HIGH(p_request->wValue); uint8_t itf = TU_U16_LOW(p_request->wIndex); + (void) channelNum; (void) ctrlSel; (void) itf; + return false; // Yet not implemented } diff --git a/examples/rules.mk b/examples/rules.mk index dacb81363..066956a40 100644 --- a/examples/rules.mk +++ b/examples/rules.mk @@ -33,6 +33,7 @@ SRC_C += \ src/common/tusb_fifo.c \ src/device/usbd.c \ src/device/usbd_control.c \ + src/class/audio/audio_device.c \ src/class/cdc/cdc_device.c \ src/class/dfu/dfu_rt_device.c \ src/class/hid/hid_device.c \ |
