void pin_setup(void) { int i; #ifdef AIRSPY_NOS #else /* AIRSPY One/Demo */ uint8_t serial_clock_rate; uint8_t clock_prescale_rate; #endif /* Configure all GPIO as Input (safe state) */ GPIO0_DIR = 0; GPIO1_DIR = 0; GPIO2_DIR = 0; GPIO3_DIR = 0; GPIO4_DIR = 0; GPIO5_DIR = 0; GPIO6_DIR = 0; GPIO7_DIR = 0; /* Pin configuration for all pins */ for(i = 0; i < GPIO_CONF_NB; i++) { scu_pinmux(gpio_conf[i].group_pin, gpio_conf[i].scu_conf); } /* GPIO1[7] on P1_14 as output. */ GPIO1_DIR |= PIN_EN_R820T; disable_r820t_power(); /* GPIO1[13] on P2_13 as output. */ GPIO1_DIR |= PIN_EN_BIAST; disable_biast_power(); #ifdef AIRSPY_NOS /* GPIO0[12] on P1_17 as output. */ GPIO0_DIR |= PIN_EN_LED1; #else /* AIRSPY One/Demo */ /* Configure SSP1 Peripheral */ #define SCU_SSP1_SCK (P1_19) /* P1_19 */ scu_pinmux(SCU_SSP1_SCK, (SCU_SSP_IO | SCU_CONF_FUNCTION1)); /* Freq About 1.12MHz => Freq = PCLK / (CPSDVSR * [SCR+1]) with PCLK=PLL1=288MHz */ clock_prescale_rate = 2; serial_clock_rate = 128; ssp_init(SSP1_NUM, SSP_DATA_8BITS, SSP_FRAME_SPI, SSP_CPOL_0_CPHA_0, serial_clock_rate, clock_prescale_rate, SSP_MODE_NORMAL, SSP_MASTER, SSP_SLAVE_OUT_ENABLE); #endif led_off(); }
void ADCHS_stop(airspy_samplerate_t conf_num) { start_stop_adchs_m4(conf_num, STOP_ADCHS_CMD); /* Re-Init I2C0 & I2C1 after PLL1 frequency is modified */ i2c0_init(AIRSPY_I2C0_PLL1_LS_HS_CONF_VAL); /* Si5351C I2C peripheral */ i2c1_init(AIRSPY_I2C1_PLL1_LS_CONF_VAL); /* R820T I2C peripheral */ disable_r820t_power(); }