From 0c342f9ceaf4fcd2a217f2fafe9a22bec87c10c2 Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Thu, 7 Mar 2013 14:56:32 -0700 Subject: [PATCH 1/2] .gitignore additions: .dfu in /firmware, .pdf and .svg in /hardware --- firmware/.gitignore | 1 + hardware/.gitignore | 2 ++ 2 files changed, 3 insertions(+) diff --git a/firmware/.gitignore b/firmware/.gitignore index 756442ec..ec522d99 100644 --- a/firmware/.gitignore +++ b/firmware/.gitignore @@ -6,3 +6,4 @@ *.map *.o *.srec +*.dfu diff --git a/hardware/.gitignore b/hardware/.gitignore index 64039541..4fe684ca 100644 --- a/hardware/.gitignore +++ b/hardware/.gitignore @@ -19,3 +19,5 @@ $savepcb.* # other kicad generated files *.csv +*.svg +*.pdf From 50f7481682d69650eb2ac40afd93d3e1d9bdd1f9 Mon Sep 17 00:00:00 2001 From: Michael Ossmann Date: Thu, 7 Mar 2013 15:18:05 -0700 Subject: [PATCH 2/2] usb_vendor_request_set_amp_enable --- firmware/usb_performance/usb_performance.c | 34 +++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/firmware/usb_performance/usb_performance.c b/firmware/usb_performance/usb_performance.c index 8a5c59c2..f3c3e13a 100644 --- a/firmware/usb_performance/usb_performance.c +++ b/firmware/usb_performance/usb_performance.c @@ -495,6 +495,37 @@ usb_request_status_t usb_vendor_request_read_version_string( return USB_REQUEST_STATUS_OK; } +usb_request_status_t usb_vendor_request_set_amp_enable( + usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage) +{ + if (stage == USB_TRANSFER_STAGE_SETUP) { + switch (endpoint->setup.value) { + case 0: + switchctrl |= SWITCHCTRL_AMP_BYPASS; + if (transceiver_mode == TRANSCEIVER_MODE_RX) { + rffc5071_rx(switchctrl); + } else if (transceiver_mode == TRANSCEIVER_MODE_TX) { + rffc5071_tx(switchctrl); + } + usb_endpoint_schedule_ack(endpoint->in); + return USB_REQUEST_STATUS_OK; + case 1: + switchctrl &= ~SWITCHCTRL_AMP_BYPASS; + if (transceiver_mode == TRANSCEIVER_MODE_RX) { + rffc5071_rx(switchctrl); + } else if (transceiver_mode == TRANSCEIVER_MODE_TX) { + rffc5071_tx(switchctrl); + } + usb_endpoint_schedule_ack(endpoint->in); + return USB_REQUEST_STATUS_OK; + default: + return USB_REQUEST_STATUS_STALL; + } + } else { + return USB_REQUEST_STATUS_OK; + } +} + static const usb_request_handler_fn vendor_request_handler[] = { NULL, usb_vendor_request_set_transceiver_mode, @@ -511,7 +542,8 @@ static const usb_request_handler_fn vendor_request_handler[] = { usb_vendor_request_read_spiflash, usb_vendor_request_write_cpld, usb_vendor_request_read_board_id, - usb_vendor_request_read_version_string + usb_vendor_request_read_version_string, + usb_vendor_request_set_amp_enable }; static const uint32_t vendor_request_handler_count =