diff --git a/include/hamlib/rig.h b/include/hamlib/rig.h index 01a8fb4e7..5e8801e0c 100644 --- a/include/hamlib/rig.h +++ b/include/hamlib/rig.h @@ -2267,8 +2267,7 @@ rigerror HAMLIB_PARAMS((int errnum)); extern HAMLIB_EXPORT(int) rig_setting2idx HAMLIB_PARAMS((setting_t s)); -#define rig_idx2setting(i) (1ULL<<(i)) - +extern setting_t rig_idx2setting(int i); /* * Even if these functions are prefixed with "rig_", they are not rig specific * Maybe "hamlib_" would have been better. Let me know. --SF diff --git a/src/misc.c b/src/misc.c index f4351e655..730d96905 100644 --- a/src/misc.c +++ b/src/misc.c @@ -522,6 +522,14 @@ static struct { RIG_FUNC_NONE, "" }, }; +/** + * utility function to convert index to bit value + * + */ +uint64_t rig_idx2setting(int i) +{ + return 1ULL << i; +} /** * \brief Convert alpha string to enum RIG_FUNC_... diff --git a/src/misc.h b/src/misc.h index 19605f417..5774eeb7a 100644 --- a/src/misc.h +++ b/src/misc.h @@ -96,6 +96,7 @@ extern HAMLIB_EXPORT(int) rig_check_cache_timeout(const struct timeval *tv, extern HAMLIB_EXPORT(void) rig_force_cache_timeout(struct timeval *tv); +extern HAMLIB_EXPORT(setting_t) rig_idx2setting(int i); #ifdef PRId64 /** \brief printf(3) format to be used for long long (64bits) type */