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

Function to_bcd_be

src/misc.c:229–258  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

227 * \sa to_bcd()
228 */
229unsigned char *HAMLIB_API to_bcd_be(unsigned char bcd_data[],
230 unsigned long long freq,
231 unsigned bcd_len)
232{
233 int i;
234
235 /* '450'/4 -> 0,4;5,0 */
236 /* '450'/3 -> 4,5;0,x */
237
238 rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
239
240 if (bcd_len & 1)
241 {
242 bcd_data[bcd_len / 2] &= 0x0f;
243 bcd_data[bcd_len / 2] |= (freq % 10) <<
244 4; /* NB: low nibble is left uncleared */
245 freq /= 10;
246 }
247
248 for (i = (bcd_len / 2) - 1; i >= 0; i--)
249 {
250 unsigned char a = freq % 10;
251 freq /= 10;
252 a |= (freq % 10) << 4;
253 freq /= 10;
254 bcd_data[i] = a;
255 }
256
257 return bcd_data;
258}
259
260
261/**

Callers 15

wj_transactionFunction · 0.85
icom_set_cmdFunction · 0.85
icom_set_levelFunction · 0.85
icom_set_ctcss_toneFunction · 0.85
icom_set_ctcss_sqlFunction · 0.85
icom_set_dcs_codeFunction · 0.85
icom_set_dcs_sqlFunction · 0.85
icom_set_memFunction · 0.85
icom_set_bankFunction · 0.85
icom_set_rawFunction · 0.85
icom_send_voice_memFunction · 0.85
ic756pro2_set_ext_parmFunction · 0.85

Calls 1

rig_debugFunction · 0.85

Tested by 1

mainFunction · 0.68