|
|
|
|
@ -318,11 +318,12 @@ void ADF4351_WriteRegister32(int channel, const uint32_t value)
|
|
|
|
|
// if (reg_dirty[value & 0x07] || (value & 0x07) == 0) {
|
|
|
|
|
if (old_registers[value & 0x07] != registers[value & 0x07] || (value & 0x07) == 0 ) {
|
|
|
|
|
registers[value & 0x07] = value;
|
|
|
|
|
for (int i = 3; i >= 0; i--) shiftOut((value >> (8 * i)) & 0xFF);
|
|
|
|
|
palSetLine(ADF4351_LE[channel]);
|
|
|
|
|
my_microsecond_delay(1); // Must
|
|
|
|
|
palClearLine(ADF4351_LE[channel]);
|
|
|
|
|
// reg_dirty[value & 0x07] = false;
|
|
|
|
|
shiftOut((value >> 24) & 0xFF);
|
|
|
|
|
shiftOut((value >> 16) & 0xFF);
|
|
|
|
|
shiftOut((value >> 8) & 0xFF);
|
|
|
|
|
shiftOut((value >> 0) & 0xFF);
|
|
|
|
|
palSetLine(ADF4351_LE[channel]);
|
|
|
|
|
old_registers[value & 0x07] = registers[value & 0x07];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -332,11 +333,6 @@ void ADF4351_Set(int channel)
|
|
|
|
|
set_SPI_mode(SPI_MODE_SI);
|
|
|
|
|
if (SI4432_SPI_SPEED != ADF_SPI_SPEED)
|
|
|
|
|
SPI_BR_SET(SI4432_SPI, ADF_SPI_SPEED);
|
|
|
|
|
|
|
|
|
|
// my_microsecond_delay(1);
|
|
|
|
|
palClearLine(ADF4351_LE[channel]);
|
|
|
|
|
// my_microsecond_delay(1);
|
|
|
|
|
|
|
|
|
|
for (int i = 5; i >= 0; i--) {
|
|
|
|
|
ADF4351_WriteRegister32(channel, registers[i]);
|
|
|
|
|
}
|
|
|
|
|
@ -720,13 +716,13 @@ void SI4463_do_api(void* data, uint8_t len, void* out, uint8_t outLen)
|
|
|
|
|
while (!SI4463_READ_CTS);// {SHORT_DELAY; } // Wait for CTS
|
|
|
|
|
SI_CS_LOW;
|
|
|
|
|
#if 1 // Inline transfer
|
|
|
|
|
while (len-- > 0) {
|
|
|
|
|
while (len--){
|
|
|
|
|
while (SPI_TX_IS_NOT_EMPTY(SI4432_SPI));
|
|
|
|
|
SPI_WRITE_8BIT(SI4432_SPI, *ptr++);
|
|
|
|
|
}
|
|
|
|
|
while (SPI_IS_BUSY(SI4432_SPI));
|
|
|
|
|
#else
|
|
|
|
|
while (len-- > 0)
|
|
|
|
|
while (len--)
|
|
|
|
|
shiftOut(*ptr++); // (pgm_read_byte(&((uint8_t*)data)[i]));
|
|
|
|
|
#endif
|
|
|
|
|
SI_CS_HIGH;
|
|
|
|
|
@ -747,7 +743,7 @@ void SI4463_do_api(void* data, uint8_t len, void* out, uint8_t outLen)
|
|
|
|
|
#endif
|
|
|
|
|
// Get response data
|
|
|
|
|
ptr = (uint8_t *)out;
|
|
|
|
|
while (outLen-- > 0) {
|
|
|
|
|
while (outLen--){
|
|
|
|
|
#if 1 // Inline transfer
|
|
|
|
|
SPI_WRITE_8BIT(SI4432_SPI, 0x00);
|
|
|
|
|
while (SPI_RX_IS_EMPTY(SI4432_SPI)); //wait rx data in buffer
|
|
|
|
|
@ -755,9 +751,8 @@ void SI4463_do_api(void* data, uint8_t len, void* out, uint8_t outLen)
|
|
|
|
|
#else
|
|
|
|
|
*ptr++ = shiftIn();
|
|
|
|
|
#endif
|
|
|
|
|
SI_CS_HIGH;
|
|
|
|
|
}
|
|
|
|
|
// __enable_irq();
|
|
|
|
|
SI_CS_HIGH;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef notused
|
|
|
|
|
@ -790,7 +785,7 @@ static void SI4463_set_properties(uint16_t prop, void* values, uint8_t len)
|
|
|
|
|
#define GLOBAL_GPIO_PIN_CFG 0x13, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
|
|
|
#define GLOBAL_CLK_CFG 0x11, 0x00, 0x01, 0x01, 0x00
|
|
|
|
|
// ---------------------------------------------------------------------------------------------------- v ------------ RSSI control byte
|
|
|
|
|
#define GLOBAL_RF_MODEM_RAW_CONTROL 0x11, 0x20, 0x0A, 0x45, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x06, 0x03, 0x10, 0x40
|
|
|
|
|
#define GLOBAL_RF_MODEM_RAW_CONTROL 0x11, 0x20, 0x0A, 0x45, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x06, 0x18, 0x10, 0x40
|
|
|
|
|
//0x11 SI446X_CMD_SET_PROPERTY
|
|
|
|
|
//0x20 SI446X_PROP_GROUP_MODEM
|
|
|
|
|
//0x0A 10 Count
|
|
|
|
|
@ -802,7 +797,7 @@ static void SI4463_set_properties(uint16_t prop, void* values, uint8_t len)
|
|
|
|
|
//0x00 [0x49] MODEM_ANT_DIV_CONTROL
|
|
|
|
|
//0xFF [0x4A] MODEM_RSSI_THRESH
|
|
|
|
|
//0x06 [0x4B] MODEM_RSSI_JUMP_THRESH
|
|
|
|
|
//0x03 [0x4C] MODEM_RSSI_CONTROL
|
|
|
|
|
//0x18 [0x4C] MODEM_RSSI_CONTROL
|
|
|
|
|
//0x10 [0x4D] MODEM_RSSI_CONTROL2
|
|
|
|
|
//0x40 [0x4E] MODEM_RSSI_COMP
|
|
|
|
|
// -----------------------------------------------------------------------------------------------------^ --------------
|
|
|
|
|
@ -1322,7 +1317,7 @@ void SI446x_Fill(int s, int start)
|
|
|
|
|
my_microsecond_delay(t);
|
|
|
|
|
#else
|
|
|
|
|
#if 1
|
|
|
|
|
SI_CS_LOW;
|
|
|
|
|
SI_CS_LOW;
|
|
|
|
|
SPI_WRITE_8BIT(SI4432_SPI, SI446X_CMD_ID_START_RX);
|
|
|
|
|
while (SPI_IS_BUSY(SI4432_SPI)) ; // wait tx
|
|
|
|
|
SPI_READ_8BIT(SI4432_SPI); // Skip command byte response
|
|
|
|
|
@ -1668,9 +1663,10 @@ freq_t SI4463_set_freq(freq_t freq)
|
|
|
|
|
#endif
|
|
|
|
|
} else
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
si_set_offset(0);
|
|
|
|
|
|
|
|
|
|
if (SI4463_offset_active) {
|
|
|
|
|
si_set_offset(0);
|
|
|
|
|
SI4463_offset_active = false;
|
|
|
|
|
}
|
|
|
|
|
uint32_t R = (freq * SI4463_outdiv) / (Npresc ? 2*config.setting_frequency_30mhz : 4*config.setting_frequency_30mhz) - 1; // R between 0x00 and 0x7f (127)
|
|
|
|
|
uint64_t MOD = 524288; // = 2^19
|
|
|
|
|
uint32_t F = ((freq * SI4463_outdiv*MOD) / (Npresc ? 2*config.setting_frequency_30mhz : 4*config.setting_frequency_30mhz)) - R*MOD;
|
|
|
|
|
|