Skip to content

legacy-api gain #120

@raccoman

Description

@raccoman

Hi, inside the legacy-api how do I specify the gainToUse?
Cause seems to be set by default on UNKNOWN but I need to change the LNA, TIA and PGA gains.

LMS_APIDevice(lime::SDRDevice* device)
    : device(device)
    , lastSavedStreamConfig()
    , lastSavedLPFValue()
    , statsDeltas()
    , moduleIndex(0)
    , deviceInfo(nullptr)
    , rxGain(lime::eGainTypes::UNKNOWN)
    , txGain(lime::eGainTypes::UNKNOWN)
{
}

API_EXPORT int CALL_CONV LMS_SetGaindB(lms_device_t* device, bool dir_tx, size_t chan, unsigned gain)
{
    LMS_APIDevice* apiDevice = CheckDevice(device, chan);
    if (apiDevice == nullptr)
    {
        return -1;
    }

    const lime::TRXDir direction = DirFromBool(dir_tx);
    auto gainToUse = dir_tx ? apiDevice->txGain : apiDevice->rxGain;

    const OpStatus status = apiDevice->device->SetGain(apiDevice->moduleIndex, direction, chan, gainToUse, gain);
    return OpStatusToReturnCode(status);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions