From 5d2e32e4b83d9c4f8de49ece7e2accb742cfe194 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 6 May 2021 08:20:03 +0200 Subject: [PATCH] attenuator: rename functions to make them more descriptive --- projects/rfdsatt/attenuator.c | 4 ++-- projects/rfdsatt/attenuator.h | 4 ++-- projects/rfdsatt/rfdsatt.c | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/projects/rfdsatt/attenuator.c b/projects/rfdsatt/attenuator.c index 3fc272f..851b2ab 100644 --- a/projects/rfdsatt/attenuator.c +++ b/projects/rfdsatt/attenuator.c @@ -75,7 +75,7 @@ static void _attenuator_stage_set(uint8_t channel, uint8_t stage, uint8_t val_qd * \param stage Attenuator stage (0..1) * \param value in quarter-dB (0..124) */ -int attenuator_set(uint8_t channel, uint8_t stage, uint8_t val_qdb) +int attenuator_stage_set(uint8_t channel, uint8_t stage, uint8_t val_qdb) { uint8_t val = val_qdb/4; /* whole dB for this attenuator */ @@ -99,7 +99,7 @@ int attenuator_set(uint8_t channel, uint8_t stage, uint8_t val_qdb) } /* get current attenuator value in quarter-dB */ -int attenuator_get(uint8_t channel, uint8_t stage, enum attenuator_value av) +int attenuator_stage_get(uint8_t channel, uint8_t stage, enum attenuator_value av) { if (!g_att_cfg) return -ENODEV; diff --git a/projects/rfdsatt/attenuator.h b/projects/rfdsatt/attenuator.h index ec06505..146ba41 100644 --- a/projects/rfdsatt/attenuator.h +++ b/projects/rfdsatt/attenuator.h @@ -39,7 +39,7 @@ struct attenuator_state { } value_qdB; }; -int attenuator_set(uint8_t channel, uint8_t stage, uint8_t val_qdb); -int attenuator_get(uint8_t channel, uint8_t stage, enum attenuator_value av); +int attenuator_stage_set(uint8_t channel, uint8_t stage, uint8_t val_qdb); +int attenuator_stage_get(uint8_t channel, uint8_t stage, enum attenuator_value av); void attenuator_init(const struct attenuator_cfg *cfg, struct attenuator_state **state); diff --git a/projects/rfdsatt/rfdsatt.c b/projects/rfdsatt/rfdsatt.c index 49461d0..42a0044 100644 --- a/projects/rfdsatt/rfdsatt.c +++ b/projects/rfdsatt/rfdsatt.c @@ -189,7 +189,7 @@ DEFUN(att_show, att_show_cmd, "show", "Show state of all attenuators") int sum_qdb = 0; for (stage = 0; stage < ARRAY_SIZE(stage_qdb); stage++) { - stage_qdb[stage] = attenuator_get(channel, stage, ATT_VAL_CURRENT); + stage_qdb[stage] = attenuator_stage_get(channel, stage, ATT_VAL_CURRENT); sum_qdb += stage_qdb[stage]; } printf("Channel %02u: Stage1 %02d dB, Stage2 %02d dB, Sum %02d dB\r\n", @@ -213,7 +213,7 @@ DEFUN(att_set, att_set_cmd, "set", printf("Setting attenuator channel %d stage %d to %d dB...\r\n", channel, stage, dB); - rc = attenuator_set(channel, stage, dB*4); + rc = attenuator_stage_set(channel, stage, dB*4); if (rc < 0) printf("Error setting attenuator: %d\r\n", rc); } @@ -240,7 +240,7 @@ DEFUN(interact, interact_cmd, "interact", "Enter interactive single-key mode") case '1': case '2': case '3': case '4': /* channel number */ g_chan = ch - '1'; g_stage = 0; - g_val = attenuator_get(g_chan, g_stage, ATT_VAL_CURRENT); + g_val = attenuator_stage_get(g_chan, g_stage, ATT_VAL_CURRENT); break; case '0': /* set to 0dB */ g_val = 0; @@ -259,17 +259,17 @@ DEFUN(interact, interact_cmd, "interact", "Enter interactive single-key mode") case 'a': /* stage 0 */ if (g_stage != 0) { g_stage = 0; - g_val = attenuator_get(g_chan, g_stage, ATT_VAL_CURRENT); + g_val = attenuator_stage_get(g_chan, g_stage, ATT_VAL_CURRENT); } break; case 'b': /* stage 1 */ if (g_stage != 1) { g_stage = 1; - g_val = attenuator_get(g_chan, g_stage, ATT_VAL_CURRENT); + g_val = attenuator_stage_get(g_chan, g_stage, ATT_VAL_CURRENT); } break; } - rc = attenuator_set(g_chan, g_stage, g_val*4); + rc = attenuator_stage_set(g_chan, g_stage, g_val*4); if (rc < 0) printf("Error setting attenuator: %d\r\n", rc); }