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

Function from_bcd_be

src/misc.c:272–295  ·  view source on GitHub ↗

* \brief Convert 4-bit BCD digits to binary, big-endian * \param bcd_data * \param bcd_len * \return binary result * * Same as from_bcd, but in big-endian order * (e.g. byte order 12 34 56 78 90 for 1234567890 Hz) * * \sa from_bcd() */

Source from the content-addressed store, hash-verified

270 * \sa from_bcd()
271 */
272unsigned long long HAMLIB_API from_bcd_be(const unsigned char bcd_data[],
273 unsigned bcd_len)
274{
275 int i;
276 freq_t f = 0;
277
278 rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
279
280 for (i = 0; i < bcd_len / 2; i++)
281 {
282 f *= 10;
283 f += bcd_data[i] >> 4;
284 f *= 10;
285 f += bcd_data[i] & 0x0f;
286 }
287
288 if (bcd_len & 1)
289 {
290 f *= 10;
291 f += bcd_data[bcd_len / 2] >> 4;
292 }
293
294 return f;
295}
296
297size_t HAMLIB_API to_hex(size_t source_length, const unsigned char *source_data,
298 size_t dest_length, char *dest_data)

Callers 15

icom_get_cmdFunction · 0.85
icom_get_levelFunction · 0.85
icom_get_ext_levelFunction · 0.85
icom_get_ctcss_toneFunction · 0.85
icom_get_ctcss_sqlFunction · 0.85
icom_get_dcs_codeFunction · 0.85
icom_get_dcs_sqlFunction · 0.85
icom_get_rawFunction · 0.85
ic756pro2_get_ext_parmFunction · 0.85
icom_get_cmdFunction · 0.85
icom_rig_get_levelFunction · 0.85
ic746pro_get_ext_parmFunction · 0.85

Calls 1

rig_debugFunction · 0.85

Tested by 1

mainFunction · 0.68