MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / from_bcd

Function from_bcd

src/misc.c:192–214  ·  view source on GitHub ↗

* \brief Convert BCD digits, little-endian, to a long long (e.g. frequency in Hz) * \param bcd_data * \param bcd_len * \return binary result (e.g. frequency) * * Convert BCD digits, little-endian, (byte order 90 78 56 34 12 * for 1234567890 Hz) to a long long (e.g. frequency in Hz) * * bcd_len is the number of BCD digits. * * Hope the compiler will do a good job optimizing it (esp. w/ th

Source from the content-addressed store, hash-verified

190 * \sa from_bcd_be()
191 */
192unsigned long long HAMLIB_API from_bcd(const unsigned char bcd_data[],
193 unsigned bcd_len)
194{
195 int i;
196 freq_t f = 0;
197
198 rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
199
200 if (bcd_len & 1)
201 {
202 f = bcd_data[bcd_len / 2] & 0x0f;
203 }
204
205 for (i = (bcd_len / 2) - 1; i >= 0; i--)
206 {
207 f *= 10;
208 f += bcd_data[i] >> 4;
209 f *= 10;
210 f += bcd_data[i] & 0x0f;
211 }
212
213 return f;
214}
215
216
217/**

Callers 15

icom_get_freqFunction · 0.85
icom_get_rit_newFunction · 0.85
icom_get_dsp_fltFunction · 0.85
icom_get_levelFunction · 0.85
icom_get_rptr_offsFunction · 0.85
icom_get_split_freqFunction · 0.85
icom_get_clockFunction · 0.85
icom_process_async_frameFunction · 0.85
icom_get_freq_rangeFunction · 0.85
omni6_get_ritFunction · 0.85
id5100_get_freq2Function · 0.85

Calls 1

rig_debugFunction · 0.85

Tested by 1

mainFunction · 0.68