int ad9361_set_trx_fir_enable(struct iio_device *dev, int enable)
{
	int ret = iio_device_attr_write_bool(dev,
					 "in_out_voltage_filter_fir_en", !!enable);
	if (ret < 0)
		ret = iio_channel_attr_write_bool(iio_device_find_channel(dev, "out", false),
					    "voltage_filter_fir_en", !!enable);
	return ret;
}
static void iio_button_save(struct iio_widget *widget)
{
	if (widget->chn)
		iio_channel_attr_write_bool(widget->chn,
					    widget->attr_name, 1);
	else
		iio_device_attr_write_bool(widget->dev,
						   widget->attr_name, 1);
}
Beispiel #3
0
static void iio_toggle_button_save(struct iio_widget *widget)
{
	bool active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (widget->widget));
	active = widget->priv ? !active : active;

	if (widget->chn)
		iio_channel_attr_write_bool(widget->chn,
				widget->attr_name, active);
	else
		iio_device_attr_write_bool(widget->dev,
				widget->attr_name, active);
}
void filter_fir_enable(GtkToggleButton *button, gpointer data)
{
	bool rx, tx, rxtx, disable;

	if (gtk_toggle_button_get_active(button))
		return;

	rx = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (enable_fir_filter_rx));
	tx = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (fir_filter_en_tx));
	rxtx = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (enable_fir_filter_rx_tx));
	disable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (disable_all_fir_filters));

	if (rxtx || disable) {
		iio_device_attr_write_bool(dev,
				"in_out_voltage_filter_fir_en", rxtx);
	} else {
		struct iio_channel *chn;
		if (rx) {
			chn = iio_device_find_channel(dev, "voltage0", true);
			if (chn)
				iio_channel_attr_write_bool(chn, "filter_fir_en", tx);

			chn = iio_device_find_channel(dev, "voltage0", false);
			if (chn)
				iio_channel_attr_write_bool(chn, "filter_fir_en", rx);

		}

		if (tx) {
			chn = iio_device_find_channel(dev, "voltage0", false);
			if (chn)
				iio_channel_attr_write_bool(chn, "filter_fir_en", rx);

			chn = iio_device_find_channel(dev, "voltage0", true);
			if (chn)
				iio_channel_attr_write_bool(chn, "filter_fir_en", tx);

		}
	}

	filter_fir_update();
	glb_settings_update_labels();
	update_widgets();
	rx_freq_info_update();
}