예제 #1
0
void set_transceiver_mode(const transceiver_mode_t new_transceiver_mode) {
	baseband_streaming_disable(&sgpio_config);
	
	usb_endpoint_disable(&usb_endpoint_bulk_in);
	usb_endpoint_disable(&usb_endpoint_bulk_out);
	
	_transceiver_mode = new_transceiver_mode;
	
	if( _transceiver_mode == TRANSCEIVER_MODE_RX ) {
		led_off(LED3);
		led_on(LED2);
		usb_endpoint_init(&usb_endpoint_bulk_in);
		rf_path_set_direction(&rf_path, RF_PATH_DIRECTION_RX);
		vector_table.irq[NVIC_SGPIO_IRQ] = sgpio_isr_rx;
	} else if (_transceiver_mode == TRANSCEIVER_MODE_TX) {
		led_off(LED2);
		led_on(LED3);
		usb_endpoint_init(&usb_endpoint_bulk_out);
		rf_path_set_direction(&rf_path, RF_PATH_DIRECTION_TX);
		vector_table.irq[NVIC_SGPIO_IRQ] = sgpio_isr_tx;
	} else {
		led_off(LED2);
		led_off(LED3);
		rf_path_set_direction(&rf_path, RF_PATH_DIRECTION_OFF);
		vector_table.irq[NVIC_SGPIO_IRQ] = sgpio_isr_rx;
	}

	if( _transceiver_mode != TRANSCEIVER_MODE_OFF ) {
		si5351c_activate_best_clock_source(&clock_gen);
		baseband_streaming_enable(&sgpio_config);
	}
}
예제 #2
0
파일: hackrf_usb.c 프로젝트: burkeen/hackrf
void baseband_streaming_disable() {
	sgpio_cpld_stream_disable();

	nvic_disable_irq(NVIC_SGPIO_IRQ);
	
	usb_endpoint_disable(&usb_endpoint_bulk_in);
	usb_endpoint_disable(&usb_endpoint_bulk_out);
}
예제 #3
0
void usb_configuration_changed(
	usb_device_t* const device
) {
        if (device->configuration == 0) {
            usb_endpoint_disable(&usb_endpoint_bulk_cmd_in);
            usb_endpoint_disable(&usb_endpoint_bulk_cmd_out);
            usb_endpoint_disable(&usb_endpoint_bulk_data_in);
        } else {
            usb_endpoint_init(&usb_endpoint_bulk_cmd_out);
            usb_endpoint_init(&usb_endpoint_bulk_cmd_in);
            usb_endpoint_init(&usb_endpoint_bulk_data_in);
            start_command_transfer();
        }
}