summaryrefslogtreecommitdiff
path: root/device-functions.c
blob: 048241a4801d6c9072a05ddff8bd58192b4217a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "device-functions.h"
#include "globals.h"

/* START FUNCTION DESCRIPTION ********************************************
Set_frequency								 <DEVFUNC.LIB>

SYNTAX: Set_frequency(int check_possible_only,int word_override,int range_override,int channel,float set_freq)

KEYWORDS:

DESCRIPTION: sets the offset DAC.

RETURN VALUE: error code (zero = OK).
END DESCRIPTION **********************************************************/

/*----------------------------------------------------------------------------------------------------------*/
int Set_frequency(int check_possible_only,int word_override,int range_override,int channel,float set_freq)
{
	// keep, but ignore, the first 3 parameters for now

	// all this does right now is check the frequency range,
	// and store the set value.

	/* abandon if high channel selected by user but not enabled by firmware */
	if (channel && !globals.Flash.ChanKey_frequency) {
		return InvalidChannel;
	}

	if (set_freq < globals.Flash.min_freq[channel]) {
		return freq_lower_limit;
	}
	if (set_freq > globals.Flash.max_freq[channel]) {
		return freq_upper_limit;
	}

	globals.ChannelState[channel].frequency=set_freq;

	return OK;
}