bladeRF-cli: print and set bitmode functions implemented

This commit is contained in:
Ryan Thompson 2022-08-29 11:42:24 -05:00 • committed by Robert Ghilduta
commit 6162224ebb
3 changed files with 43 additions and 0 deletions

View file

@ -91,6 +91,7 @@ PRINTSET_DECL(refin_freq);
PRINTSET_DECL(rssi);
PRINTSET_DECL(rx_mux);
PRINTSET_DECL(tuning_mode);
PRINTSET_DECL(bitmode);
PRINTSET_DECL(rxvga1);
PRINTSET_DECL(rxvga2);
PRINTSET_DECL(samplerate);
@ -110,6 +111,7 @@ struct printset_entry printset_table[] = {
PRINTSET_ENTRY(bandwidth, PRINTALL_OPTION_APPEND_NEWLINE, BOARD_ANY),
PRINTSET_ENTRY(frequency, PRINTALL_OPTION_APPEND_NEWLINE, BOARD_ANY),
PRINTSET_ENTRY(tuning_mode, PRINTALL_OPTION_APPEND_NEWLINE, BOARD_ANY),
PRINTSET_ENTRY(bitmode, PRINTALL_OPTION_APPEND_NEWLINE, BOARD_ANY),
PRINTSET_ENTRY(agc, PRINTALL_OPTION_APPEND_NEWLINE, BOARD_ANY),
PRINTSET_ENTRY(clock_ref, PRINTALL_OPTION_NONE, BOARD_BLADERF2),
PRINTSET_ENTRY(refin_freq, PRINTALL_OPTION_NONE, BOARD_BLADERF2),

View file

@ -104,6 +104,8 @@ int print_rx_mux(struct cli_state *state, int argc, char **argv);
int set_rx_mux(struct cli_state *state, int argc, char **argv);
int print_tuning_mode(struct cli_state *state, int argc, char **argv);
int set_tuning_mode(struct cli_state *state, int argc, char **argv);
int print_bitmode(struct cli_state *state, int argc, char **argv);
int set_bitmode(struct cli_state *state, int argc, char **argv);
int print_rxvga1(struct cli_state *state, int argc, char **argv);
int set_rxvga1(struct cli_state *state, int argc, char **argv);
int print_rxvga2(struct cli_state *state, int argc, char **argv);

View file

@ -1221,6 +1221,45 @@ out:
return rv;
}
/* bitmode */
int print_bitmode(struct cli_state *state, int argc, char **argv)
{
int rv = CLI_RET_OK;
printf(" Bit Mode: %s bit samples\n", state->bit_mode_8bit ? "8" : "16");
return rv;
}
int set_bitmode(struct cli_state *state, int argc, char **argv)
{
int rv = CLI_RET_OK;
if (cli_device_is_streaming(state)) {
printf(" Warning: Changing bit mode will not take affect while device"
" is streaming.\n\n");
}
if (argc != 3) {
if (argc == 2) {
printf("Usage: %s %s <8|16>\n", argv[0], argv[1]);
return 0;
} else {
return CLI_RET_NARGS;
}
}
if (!strcasecmp("16", argv[2]) || !strcasecmp("16bit", argv[2])) {
state->bit_mode_8bit = false;
} else if (!strcasecmp("8", argv[2]) || !strcasecmp("8bit", argv[2])) {
state->bit_mode_8bit = true;
} else {
return CLI_RET_INVPARAM;
}
rv = print_bitmode(state, 0, NULL);
return rv;
}
/* rxvga1 */
int print_rxvga1(struct cli_state *state, int argc, char **argv)
{