Closed jynik closed 11 years ago
This code from the CLI should be integrated into an API call, and the CLI adjusted to use this:
int set_sampling(struct cli_state *state, int argc, char **argv) { /* Usage: set sampling [internal|external] */ int rv = CMD_RET_OK; uint8_t val = 0; if( argc != 3 ) { rv = CMD_RET_NARGS ; } else { if( strcasecmp( "internal", argv[2] ) == 0 ) { /* Disconnect the ADC input from the outside world */ bladerf_lms_read( state->dev, 0x09, &val ); val &= ~(1<<7) ; bladerf_lms_write( state->dev, 0x09, val ); /* Turn on RXVGA2 */ bladerf_lms_read( state->dev, 0x64, &val ); val |= (1<<1) ; bladerf_lms_write( state->dev, 0x64, val ); } else if( strcasecmp( "external", argv[2] ) == 0 ) { /* Turn off RXVGA2 */ bladerf_lms_read( state->dev, 0x64, &val ); val &= ~(1<<1) ; bladerf_lms_write( state->dev, 0x64, val ); /* Connect the external ADC pins to the internal ADC input */ bladerf_lms_read( state->dev, 0x09, &val ); val |= (1<<7) ; bladerf_lms_write( state->dev, 0x09, val ); } else { cli_err(state, argv[0], "Invalid sampling mode (%s)", argv[2] ); } } return rv; }
Addressed in 4d8312b59bf0b3327c74d0ea9615c8c05ed84c7d
This code from the CLI should be integrated into an API call, and the CLI adjusted to use this: