Hamlib  4.0~git
idx_builtin.h
1 /*
2  * Hamlib Interface - setting2idx for builtin constants
3  * Copyright (c) 2002-2005 by Stephane Fillod and Frank Singleton
4  *
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  */
21 
22 #ifndef _IDX_BUILTIN_H
23 #define _IDX_BUILTIN_H 1
24 
25 #include <hamlib/rig.h>
26 
27 /*
28  * only for Hamlib internal use (backend caps)
29  * This is a rig_setting2idx version that works for builtin_constant,
30  * hence allowing its use in array initializers. The compiler simplifies
31  * everything at compile time.
32  *
33  * struct rig_caps foo = {
34  * .level_gran = { [LVL_PREAMP] = { .min = 0, .max = 20, .step = 10 } },
35  * }
36  *
37  * Of course, it can't work with setting2idx_builtin(RIG_LEVEL_XX|RIG_LEVEL_YY)
38  */
39 
40 // Note that 1<<0 is satisfied by the last clause here == 0
41 #define setting2idx_builtin(s) ( \
42  (s)==(1ull<<1)?1: \
43  (s)==(1ull<<2)?2: \
44  (s)==(1ull<<3)?3: \
45  (s)==(1ull<<4)?4: \
46  (s)==(1ull<<5)?5: \
47  (s)==(1ull<<6)?6: \
48  (s)==(1ull<<7)?7: \
49  (s)==(1ull<<8)?8: \
50  (s)==(1ull<<9)?9: \
51  (s)==(1ull<<10)?10: \
52  (s)==(1ull<<11)?11: \
53  (s)==(1ull<<12)?12: \
54  (s)==(1ull<<13)?13: \
55  (s)==(1ull<<14)?14: \
56  (s)==(1ull<<15)?15: \
57  (s)==(1ull<<16)?16: \
58  (s)==(1ull<<17)?17: \
59  (s)==(1ull<<18)?18: \
60  (s)==(1ull<<19)?19: \
61  (s)==(1ull<<20)?20: \
62  (s)==(1ull<<21)?21: \
63  (s)==(1ull<<22)?22: \
64  (s)==(1ull<<23)?23: \
65  (s)==(1ull<<24)?24: \
66  (s)==(1ull<<25)?25: \
67  0 \
68  )
69 
70 #define LVL_PREAMP setting2idx_builtin(RIG_LEVEL_PREAMP)
71 #define LVL_ATT setting2idx_builtin(RIG_LEVEL_ATT)
72 #define LVL_VOXDELAY setting2idx_builtin(RIG_LEVEL_VOXDELAY)
73 #define LVL_AF setting2idx_builtin(RIG_LEVEL_AF)
74 #define LVL_RF setting2idx_builtin(RIG_LEVEL_RF)
75 #define LVL_SQL setting2idx_builtin(RIG_LEVEL_SQL)
76 #define LVL_IF setting2idx_builtin(RIG_LEVEL_IF)
77 #define LVL_APF setting2idx_builtin(RIG_LEVEL_APF)
78 #define LVL_NR setting2idx_builtin(RIG_LEVEL_NR)
79 #define LVL_PBT_IN setting2idx_builtin(RIG_LEVEL_PBT_IN)
80 #define LVL_PBT_OUT setting2idx_builtin(RIG_LEVEL_PBT_OUT)
81 #define LVL_CWPITCH setting2idx_builtin(RIG_LEVEL_CWPITCH)
82 #define LVL_RFPOWER setting2idx_builtin(RIG_LEVEL_RFPOWER)
83 #define LVL_MICGAIN setting2idx_builtin(RIG_LEVEL_MICGAIN)
84 #define LVL_KEYSPD setting2idx_builtin(RIG_LEVEL_KEYSPD)
85 #define LVL_NOTCHF setting2idx_builtin(RIG_LEVEL_NOTCHF)
86 #define LVL_COMP setting2idx_builtin(RIG_LEVEL_COMP)
87 #define LVL_AGC setting2idx_builtin(RIG_LEVEL_AGC)
88 #define LVL_BKINDL setting2idx_builtin(RIG_LEVEL_BKINDL)
89 #define LVL_BALANCE setting2idx_builtin(RIG_LEVEL_BALANCE)
90 #define LVL_METER setting2idx_builtin(RIG_LEVEL_METER)
91 #define LVL_VOXGAIN setting2idx_builtin(RIG_LEVEL_VOXGAIN)
92 #define LVL_ANTIVOX setting2idx_builtin(RIG_LEVEL_ANTIVOX)
93 
94 #define LVL_RAWSTR setting2idx_builtin(RIG_LEVEL_RAWSTR)
95 #define LVL_SQLSTAT setting2idx_builtin(RIG_LEVEL_SQLSTAT)
96 #define LVL_SWR setting2idx_builtin(RIG_LEVEL_SWR)
97 #define LVL_ALC setting2idx_builtin(RIG_LEVEL_ALC)
98 #define LVL_STRENGTH setting2idx_builtin(RIG_LEVEL_STRENGTH)
99 /*#define LVL_BWC setting2idx_builtin(RIG_LEVEL_BWC)*/
100 
101 #define LVL_RFPOWER_METER setting2idx_builtin(RIG_LEVEL_RFPOWER_METER)
102 #define LVL_COMP_METER setting2idx_builtin(RIG_LEVEL_COMP_METER)
103 #define LVL_VD_METER setting2idx_builtin(RIG_LEVEL_VD_METER)
104 #define LVL_ID_METER setting2idx_builtin(RIG_LEVEL_ID_METER)
105 
106 #define LVL_NOTCHF_RAW setting2idx_builtin(RIG_LEVEL_NOTCHF_RAW)
107 #define LVL_MONITOR_GAIN setting2idx_builtin(RIG_LEVEL_MONITOR_GAIN)
108 
109 #define PARM_ANN setting2idx_builtin(RIG_PARM_ANN)
110 #define PARM_APO setting2idx_builtin(RIG_PARM_APO)
111 #define PARM_BACKLIGHT setting2idx_builtin(RIG_PARM_BACKLIGHT)
112 #define PARM_BEEP setting2idx_builtin(RIG_PARM_BEEP)
113 #define PARM_TIME setting2idx_builtin(RIG_PARM_TIME)
114 #define PARM_BAT setting2idx_builtin(RIG_PARM_BAT)
115 #define PARM_KEYLIGHT setting2idx_builtin(RIG_PARM_KEYLIGHT)
116 
117 
118 #endif /* _IDX_BUILTIN_H */
Hamlib rig data structures.

Generated by doxygen 1.8.14

Hamlib documentation for version 4.0~git -- Sat Apr 4 2020 16:42:11
Project page: http://www.hamlib.org