Apply Linux C Style to ic910.c

libusb-1-0
Nate Bargmann 2016-02-22 06:10:48 -06:00
rodzic ed3c48e71e
commit 97594e1c96
1 zmienionych plików z 252 dodań i 233 usunięć

Wyświetl plik

@ -45,6 +45,7 @@ static int ic910_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (mode == RIG_MODE_FM) {
mode = RIG_MODE_RTTY;
}
return icom_set_mode(rig, vfo, mode, width);
}
@ -52,9 +53,11 @@ static int ic910_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
{
/* FIX: The IC-910 has "Set FM" = 4, which is RTTY in for other radios */
int retval = icom_get_mode(rig, vfo, mode, width);
if (*mode == RIG_MODE_RTTY) {
*mode = RIG_MODE_FM;
}
return retval;
}
#endif /* HAVE_WEIRD_IC910_MODES */
@ -64,7 +67,8 @@ static int ic910_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width)
* returns 0 if they are in different bands
*/
static int compareFrequencies (RIG* rig, freq_t freq1, freq_t freq2) {
static int compareFrequencies(RIG *rig, freq_t freq1, freq_t freq2)
{
int freq1band = 0, freq2band = 0;
freq_range_t noband = RIG_FRNG_END;
@ -72,6 +76,7 @@ static int compareFrequencies (RIG* rig, freq_t freq1, freq_t freq2) {
if (freq1 >= rig->caps->rx_range_list1[freq1band].start &&
freq1 <= rig->caps->rx_range_list1[freq1band].end)
break;
++freq1band;
//fprintf(stderr, "%i\n", freq1band);
}
@ -80,6 +85,7 @@ static int compareFrequencies (RIG* rig, freq_t freq1, freq_t freq2) {
if (freq2 >= rig->caps->rx_range_list1[freq2band].start &&
freq2 <= rig->caps->rx_range_list1[freq2band].end)
break;
++freq2band;
}
@ -91,7 +97,8 @@ static int compareFrequencies (RIG* rig, freq_t freq1, freq_t freq2) {
* they are also exchanged, but we do not want that
*/
static int icom_swap_bands(RIG* rig) {
static int icom_swap_bands(RIG *rig)
{
/* TODO: actually use retval! */
int retval = 0;
rmode_t mmode, smode; /* used to store the mode */
@ -139,6 +146,7 @@ static int ic910_set_freq(RIG* rig, vfo_t vfo, freq_t freq)
freq_t oldfreq;
retval = icom_get_freq(rig, vfo, &oldfreq);
if (retval != RIG_OK) return retval;
if (!compareFrequencies(rig, freq, oldfreq)) {
@ -148,6 +156,7 @@ static int ic910_set_freq(RIG* rig, vfo_t vfo, freq_t freq)
icom_set_vfo(rig, RIG_VFO_SUB);
retval = icom_get_freq(rig, RIG_VFO_CURR, &otherfreq);
if (retval != RIG_OK) return retval;
if (otherfreq == oldfreq) {
@ -155,6 +164,7 @@ static int ic910_set_freq(RIG* rig, vfo_t vfo, freq_t freq)
vfo = RIG_VFO_SUB;
icom_set_vfo(rig, RIG_VFO_MAIN);
retval = icom_get_freq(rig, RIG_VFO_CURR, &otherfreq);
if (retval != RIG_OK) return retval;
} else {
/* we were in mainband */
@ -168,6 +178,7 @@ static int ic910_set_freq(RIG* rig, vfo_t vfo, freq_t freq)
icom_set_vfo(rig, RIG_VFO_MAIN);
retval = icom_get_freq(rig, RIG_VFO_CURR, &otherfreq);
if (retval != RIG_OK) return retval;
}
@ -176,6 +187,7 @@ static int ic910_set_freq(RIG* rig, vfo_t vfo, freq_t freq)
icom_set_vfo(rig, vfo);
}
return icom_set_freq(rig, RIG_VFO_CURR, freq);
}
@ -302,29 +314,34 @@ const struct rig_caps ic910_caps = {
{ 1, 99, RIG_MTYPE_MEM },
{ 100, 105, RIG_MTYPE_EDGE },
{ 106, 106, RIG_MTYPE_CALL },
RIG_CHAN_END, },
RIG_CHAN_END,
},
.rx_range_list1 = { /* USA */
{MHz(144), MHz(148), IC910_MODES, -1, -1, IC910_VFO_ALL},
{MHz(430), MHz(450), IC910_MODES, -1, -1, IC910_VFO_ALL},
{MHz(1240), MHz(1300), IC910_MODES, -1, -1, IC910_VFO_ALL},
RIG_FRNG_END, },
RIG_FRNG_END,
},
.tx_range_list1 = {
{MHz(144), MHz(148), IC910_MODES, W(5), W(100), IC910_VFO_ALL},
{MHz(430), MHz(450), IC910_MODES, W(5), W(75), IC910_VFO_ALL},
{MHz(1240), MHz(1300), IC910_MODES, -1, -1, IC910_VFO_ALL},
RIG_FRNG_END, },
RIG_FRNG_END,
},
.rx_range_list2 = { /* Europe */
{MHz(144), MHz(146), IC910_MODES, -1, -1, IC910_VFO_ALL},
{MHz(430), MHz(440), IC910_MODES, -1, -1, IC910_VFO_ALL},
{MHz(1240), MHz(1300), IC910_MODES, -1, -1, IC910_VFO_ALL},
RIG_FRNG_END, },
RIG_FRNG_END,
},
.tx_range_list2 = {
{MHz(144), MHz(146), IC910_MODES, W(5), W(100), IC910_VFO_ALL},
{MHz(430), MHz(440), IC910_MODES, W(5), W(75), IC910_VFO_ALL},
{MHz(1240), MHz(1300), IC910_MODES, -1, -1, IC910_VFO_ALL},
RIG_FRNG_END, },
RIG_FRNG_END,
},
.tuning_steps = {
{RIG_MODE_SSB | RIG_MODE_CW, 1},
@ -339,14 +356,16 @@ const struct rig_caps ic910_caps = {
{RIG_MODE_FM, kHz(20)},
{RIG_MODE_FM, kHz(25)},
{RIG_MODE_FM, kHz(100)},
RIG_TS_END, },
RIG_TS_END,
},
/* mode/filter list, remember: order matters! */
.filters = {
{RIG_MODE_CW | RIG_MODE_SSB, kHz(2.3)}, /* builtin */
{RIG_MODE_CW, Hz(600)}, /* with optional FL-132/Fl133 CW filters */
{RIG_MODE_FM, kHz(15)}, /* builtin */
{RIG_MODE_FM, kHz(6)}, /* builtin */
RIG_FLT_END, },
RIG_FLT_END,
},
.str_cal = IC910_STR_CAL,
.priv = (void *)& ic910_priv_caps,