Renamed "bcd2bin" utility to "bcdToBin" to avoid conflicting with Zephyr includes

pull/193/head
Silvano Seva 2023-07-26 12:18:05 +02:00
rodzic 7ce3a8a605
commit ebc5910015
8 zmienionych plików z 31 dodań i 31 usunięć

Wyświetl plik

@ -61,7 +61,7 @@ float dBmToWatt(const uint8_t n);
* \internal Utility function to convert 4 byte BCD values into a 32-bit
* unsigned integer ones.
*/
uint32_t bcd2bin(uint32_t bcd);
uint32_t bcdToBin(uint32_t bcd);
#ifdef __cplusplus
}

Wyświetl plik

@ -59,7 +59,7 @@ float dBmToWatt(const uint8_t n)
return power;
}
uint32_t bcd2bin(uint32_t bcd)
uint32_t bcdToBin(uint32_t bcd)
{
return ((bcd >> 28) & 0x0F) * 10000000 +
((bcd >> 24) & 0x0F) * 1000000 +

Wyświetl plik

@ -138,8 +138,8 @@ int cps_readChannel(channel_t *channel, uint16_t pos)
channel->bandwidth = chData.bandwidth;
channel->rx_only = chData.rx_only;
channel->power = ((chData.power == 1) ? 135 : 100);
channel->rx_frequency = bcd2bin(chData.rx_frequency) * 10;
channel->tx_frequency = bcd2bin(chData.tx_frequency) * 10;
channel->rx_frequency = bcdToBin(chData.rx_frequency) * 10;
channel->tx_frequency = bcdToBin(chData.tx_frequency) * 10;
channel->scanList_index = chData.scan_list_index;
channel->groupList_index = chData.group_list_index;
memcpy(channel->name, chData.name, sizeof(chData.name));
@ -159,7 +159,7 @@ int cps_readChannel(channel_t *channel, uint16_t pos)
{
for(int i = 0; i < MAX_TONE_INDEX; i++)
{
if(ctcss_tone[i] == ((uint16_t) bcd2bin(rx_css)))
if(ctcss_tone[i] == ((uint16_t) bcdToBin(rx_css)))
{
channel->fm.rxTone = i;
channel->fm.rxToneEn = 1;
@ -172,7 +172,7 @@ int cps_readChannel(channel_t *channel, uint16_t pos)
{
for(int i = 0; i < MAX_TONE_INDEX; i++)
{
if(ctcss_tone[i] == ((uint16_t) bcd2bin(tx_css)))
if(ctcss_tone[i] == ((uint16_t) bcdToBin(tx_css)))
{
channel->fm.txTone = i;
channel->fm.txToneEn = 1;

Wyświetl plik

@ -78,8 +78,8 @@ int cps_readChannel(channel_t *channel, uint16_t pos)
channel->bandwidth = chData.bandwidth;
channel->rx_only = chData.rx_only;
channel->power = ((chData.power == 1) ? 135 : 100);
channel->rx_frequency = bcd2bin(chData.rx_frequency) * 10;
channel->tx_frequency = bcd2bin(chData.tx_frequency) * 10;
channel->rx_frequency = bcdToBin(chData.rx_frequency) * 10;
channel->tx_frequency = bcdToBin(chData.tx_frequency) * 10;
channel->scanList_index = chData.scan_list_index;
channel->groupList_index = chData.group_list_index;
@ -105,7 +105,7 @@ int cps_readChannel(channel_t *channel, uint16_t pos)
{
for(int i = 0; i < MAX_TONE_INDEX; i++)
{
if(ctcss_tone[i] == ((uint16_t) bcd2bin(rx_css)))
if(ctcss_tone[i] == ((uint16_t) bcdToBin(rx_css)))
{
channel->fm.rxTone = i;
channel->fm.rxToneEn = 1;
@ -118,7 +118,7 @@ int cps_readChannel(channel_t *channel, uint16_t pos)
{
for(int i = 0; i < MAX_TONE_INDEX; i++)
{
if(ctcss_tone[i] == ((uint16_t) bcd2bin(tx_css)))
if(ctcss_tone[i] == ((uint16_t) bcdToBin(tx_css)))
{
channel->fm.txTone = i;
channel->fm.txToneEn = 1;

Wyświetl plik

@ -55,8 +55,8 @@ static int _readChannelAtAddress(channel_t *channel, uint32_t addr)
channel->mode = chData.channel_mode;
channel->bandwidth = chData.bandwidth;
channel->rx_only = chData.rx_only;
channel->rx_frequency = bcd2bin(chData.rx_frequency) * 10;
channel->tx_frequency = bcd2bin(chData.tx_frequency) * 10;
channel->rx_frequency = bcdToBin(chData.rx_frequency) * 10;
channel->tx_frequency = bcdToBin(chData.tx_frequency) * 10;
channel->scanList_index = chData.scan_list_index;
channel->groupList_index = chData.group_list_index;
@ -95,7 +95,7 @@ static int _readChannelAtAddress(channel_t *channel, uint32_t addr)
{
for(int i = 0; i < MAX_TONE_INDEX; i++)
{
if(ctcss_tone[i] == ((uint16_t) bcd2bin(rx_css)))
if(ctcss_tone[i] == ((uint16_t) bcdToBin(rx_css)))
{
channel->fm.rxTone = i;
channel->fm.rxToneEn = 1;
@ -108,7 +108,7 @@ static int _readChannelAtAddress(channel_t *channel, uint32_t addr)
{
for(int i = 0; i < MAX_TONE_INDEX; i++)
{
if(ctcss_tone[i] == ((uint16_t) bcd2bin(tx_css)))
if(ctcss_tone[i] == ((uint16_t) bcdToBin(tx_css)))
{
channel->fm.txTone = i;
channel->fm.txToneEn = 1;

Wyświetl plik

@ -53,8 +53,8 @@ static int _readChannelAtAddress(channel_t *channel, uint32_t addr)
channel->mode = chData.channel_mode;
channel->bandwidth = chData.bandwidth;
channel->rx_only = chData.rx_only;
channel->rx_frequency = bcd2bin(chData.rx_frequency) * 10;
channel->tx_frequency = bcd2bin(chData.tx_frequency) * 10;
channel->rx_frequency = bcdToBin(chData.rx_frequency) * 10;
channel->tx_frequency = bcdToBin(chData.tx_frequency) * 10;
channel->scanList_index = chData.scan_list_index;
channel->groupList_index = chData.group_list_index;
@ -93,7 +93,7 @@ static int _readChannelAtAddress(channel_t *channel, uint32_t addr)
{
for(int i = 0; i < MAX_TONE_INDEX; i++)
{
if(ctcss_tone[i] == ((uint16_t) bcd2bin(rx_css)))
if(ctcss_tone[i] == ((uint16_t) bcdToBin(rx_css)))
{
channel->fm.rxTone = i;
channel->fm.rxToneEn = 1;
@ -106,7 +106,7 @@ static int _readChannelAtAddress(channel_t *channel, uint32_t addr)
{
for(int i = 0; i < MAX_TONE_INDEX; i++)
{
if(ctcss_tone[i] == ((uint16_t) bcd2bin(tx_css)))
if(ctcss_tone[i] == ((uint16_t) bcdToBin(tx_css)))
{
channel->fm.txTone = i;
channel->fm.txToneEn = 1;

Wyświetl plik

@ -86,13 +86,13 @@ void nvm_readCalibData(void *buf)
/*
* Ugly quirk: frequency stored in calibration data is divided by ten, so,
* after bcd2bin conversion we have something like 40'135'000. To ajdust
* after bcdToBin conversion we have something like 40'135'000. To ajdust
* things, frequency has to be multiplied by ten.
*/
for(uint8_t i = 0; i < 9; i++)
{
calib->rxFreq[i] = ((freq_t) bcd2bin(freqs[2*i])) * 10;
calib->txFreq[i] = ((freq_t) bcd2bin(freqs[2*i+1])) * 10;
calib->rxFreq[i] = ((freq_t) bcdToBin(freqs[2*i])) * 10;
calib->txFreq[i] = ((freq_t) bcdToBin(freqs[2*i+1])) * 10;
}
}
@ -122,8 +122,8 @@ void nvm_readHwInfo(hwInfo_t *info)
}
/* These devices are single-band only, either VHF or UHF. */
freqMin = ((uint16_t) bcd2bin(freqMin))/10;
freqMax = ((uint16_t) bcd2bin(freqMax))/10;
freqMin = ((uint16_t) bcdToBin(freqMin))/10;
freqMax = ((uint16_t) bcdToBin(freqMax))/10;
if(freqMin < 200)
{

Wyświetl plik

@ -71,8 +71,8 @@ void nvm_readCalibData(void *buf)
for(uint8_t i = 0; i < 9; i++)
{
calib->uhfCal.rxFreq[i] = ((freq_t) bcd2bin(freqs[2*i]));
calib->uhfCal.txFreq[i] = ((freq_t) bcd2bin(freqs[2*i+1]));
calib->uhfCal.rxFreq[i] = ((freq_t) bcdToBin(freqs[2*i]));
calib->uhfCal.txFreq[i] = ((freq_t) bcdToBin(freqs[2*i+1]));
}
/* VHF-band calibration data */
@ -99,8 +99,8 @@ void nvm_readCalibData(void *buf)
for(uint8_t i = 0; i < 5; i++)
{
calib->vhfCal.rxFreq[i] = ((freq_t) bcd2bin(freqs[2*i]));
calib->vhfCal.txFreq[i] = ((freq_t) bcd2bin(freqs[2*i+1]));
calib->vhfCal.rxFreq[i] = ((freq_t) bcdToBin(freqs[2*i]));
calib->vhfCal.txFreq[i] = ((freq_t) bcdToBin(freqs[2*i+1]));
}
}
@ -133,10 +133,10 @@ void nvm_readHwInfo(hwInfo_t *info)
if(info->name[i] == 0xFF) info->name[i] = '\0';
}
info->vhf_minFreq = ((uint16_t) bcd2bin(vhf_freqMin))/10;
info->vhf_maxFreq = ((uint16_t) bcd2bin(vhf_freqMax))/10;
info->uhf_minFreq = ((uint16_t) bcd2bin(uhf_freqMin))/10;
info->uhf_maxFreq = ((uint16_t) bcd2bin(uhf_freqMax))/10;
info->vhf_minFreq = ((uint16_t) bcdToBin(vhf_freqMin))/10;
info->vhf_maxFreq = ((uint16_t) bcdToBin(vhf_freqMax))/10;
info->uhf_minFreq = ((uint16_t) bcdToBin(uhf_freqMin))/10;
info->uhf_maxFreq = ((uint16_t) bcdToBin(uhf_freqMax))/10;
info->vhf_band = 1;
info->uhf_band = 1;
info->hw_version = lcdInfo & 0x03;