firmware, lib: update comments, doc

This commit is contained in:
Hoernchen
2013-06-17 12:32:12 +02:00
parent 839a1a170f
commit b33f534da0
5 changed files with 9 additions and 16 deletions

View File

@ -512,16 +512,10 @@ uint32_t rffc5071_config_synth_int(uint16_t lo) {
return tune_freq_hz; return tune_freq_hz;
} }
/* !!!!!!!!!!! hz is currently ignored !!!!!!!!!!! /* !!!!!!!!!!! hz is currently ignored !!!!!!!!!!! */
* uint32_t rffc5071_set_frequency(uint16_t mhz) {
* Tuning is rounded down to the nearest 25MHz or 50MHz depending on
* frequency requsted. Actual tuned value in MHz is returned. */
uint32_t rffc5071_set_frequency(uint16_t mhz, uint32_t hz) {
uint32_t tune_freq; uint32_t tune_freq;
// Fractional tuning unimplemented, 'hz' ignored
hz=hz;
rffc5071_disable(); rffc5071_disable();
tune_freq = rffc5071_config_synth_int(mhz); tune_freq = rffc5071_config_synth_int(mhz);
rffc5071_enable(); rffc5071_enable();

View File

@ -67,11 +67,8 @@ extern void rffc5071_reg_write(uint8_t r, uint16_t v);
* provided routines for those operations. */ * provided routines for those operations. */
extern void rffc5071_regs_commit(void); extern void rffc5071_regs_commit(void);
/* Set frequency (MHz). The 'hz' field is currently ignored. Actual /* Set frequency (MHz). */
* tune frequency (MHz) is returned. Expect requested freq to be extern uint32_t rffc5071_set_frequency(uint16_t mhz);
* rounded down to the nearest multiple of 25MHz or 50MHz, depending
* internal calculations. */
extern uint32_t rffc5071_set_frequency(uint16_t mhz, uint32_t hz);
/* Set up rx only, tx only, or full duplex. Chip should be disabled /* Set up rx only, tx only, or full duplex. Chip should be disabled
* before _tx, _rx, or _rxtx are called. */ * before _tx, _rx, or _rxtx are called. */

View File

@ -124,7 +124,7 @@ bool set_freq(uint32_t freq_mhz, uint32_t freq_hz)
RFFC5071_freq_mhz = MAX2837_FREQ_NOMINAL_MHZ - freq_mhz; RFFC5071_freq_mhz = MAX2837_FREQ_NOMINAL_MHZ - freq_mhz;
/* Set Freq and read real freq */ /* Set Freq and read real freq */
real_RFFC5071_freq_hz = rffc5071_set_frequency(RFFC5071_freq_mhz, 0); real_RFFC5071_freq_hz = rffc5071_set_frequency(RFFC5071_freq_mhz);
if(real_RFFC5071_freq_hz < RFFC5071_freq_mhz * FREQ_ONE_MHZ) if(real_RFFC5071_freq_hz < RFFC5071_freq_mhz * FREQ_ONE_MHZ)
{ {
tmp_hz = -(RFFC5071_freq_mhz * FREQ_ONE_MHZ - real_RFFC5071_freq_hz); tmp_hz = -(RFFC5071_freq_mhz * FREQ_ONE_MHZ - real_RFFC5071_freq_hz);
@ -150,7 +150,7 @@ bool set_freq(uint32_t freq_mhz, uint32_t freq_hz)
RFFC5071_freq_mhz = freq_mhz - MAX2837_FREQ_NOMINAL_MHZ; RFFC5071_freq_mhz = freq_mhz - MAX2837_FREQ_NOMINAL_MHZ;
/* Set Freq and read real freq */ /* Set Freq and read real freq */
real_RFFC5071_freq_hz = rffc5071_set_frequency(RFFC5071_freq_mhz, 0); real_RFFC5071_freq_hz = rffc5071_set_frequency(RFFC5071_freq_mhz);
if(real_RFFC5071_freq_hz < RFFC5071_freq_mhz * FREQ_ONE_MHZ) if(real_RFFC5071_freq_hz < RFFC5071_freq_mhz * FREQ_ONE_MHZ)
{ {
tmp_hz = (RFFC5071_freq_mhz * FREQ_ONE_MHZ - real_RFFC5071_freq_hz); tmp_hz = (RFFC5071_freq_mhz * FREQ_ONE_MHZ - real_RFFC5071_freq_hz);

View File

@ -104,7 +104,7 @@ int main(void) {
switchctrl = (SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_HP); switchctrl = (SWITCHCTRL_AMP_BYPASS | SWITCHCTRL_HP);
#endif #endif
rffc5071_rx(switchctrl); rffc5071_rx(switchctrl);
rffc5071_set_frequency(500, 0); // 500 MHz, 0 Hz (Hz ignored) rffc5071_set_frequency(500); // 500 MHz
max2837_set_frequency(freq); max2837_set_frequency(freq);
max2837_start(); max2837_start();

View File

@ -128,6 +128,8 @@ extern ADDAPI int ADDCALL hackrf_board_id_read(hackrf_device* device, uint8_t* v
extern ADDAPI int ADDCALL hackrf_version_string_read(hackrf_device* device, char* version, uint8_t length); extern ADDAPI int ADDCALL hackrf_version_string_read(hackrf_device* device, char* version, uint8_t length);
extern ADDAPI int ADDCALL hackrf_set_freq(hackrf_device* device, const uint64_t freq_hz); extern ADDAPI int ADDCALL hackrf_set_freq(hackrf_device* device, const uint64_t freq_hz);
/* range 2300-2700 Mhz */
extern ADDAPI int ADDCALL hackrf_set_if_freq(hackrf_device* device, const uint32_t freq_mhz); extern ADDAPI int ADDCALL hackrf_set_if_freq(hackrf_device* device, const uint32_t freq_mhz);
/* currently 8-20Mhz - either as a fraction, i.e. freq 20000000hz divider 2 -> 10Mhz or as plain old 10000000hz (double) /* currently 8-20Mhz - either as a fraction, i.e. freq 20000000hz divider 2 -> 10Mhz or as plain old 10000000hz (double)