1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 21:54:55 -04:00

LimeSDR: detect Lime hardware type. Interface with GPIO only for SPI and USB type

This commit is contained in:
f4exb
2018-11-29 23:37:34 +01:00
parent 83b66eb6f1
commit f3b75ead00
7 changed files with 96 additions and 50 deletions
@@ -671,18 +671,22 @@ bool LimeSDRInput::handleMessage(const Message& message)
else if (MsgGetDeviceInfo::match(message))
{
double temp = 0.0;
uint8_t gpioPins = 0;
uint8_t gpioPins = 0;
if (m_deviceShared.m_deviceParams->getDevice() && (LMS_GetChipTemperature(m_deviceShared.m_deviceParams->getDevice(), 0, &temp) != 0)) {
qWarning("LimeSDRInput::handleMessage: MsgGetDeviceInfo: cannot get temperature");
qDebug("LimeSDRInput::handleMessage: MsgGetDeviceInfo: cannot get temperature");
}
if (m_deviceShared.m_deviceParams->getDevice() && (LMS_GPIORead(m_deviceShared.m_deviceParams->getDevice(), &gpioPins, 1) != 0)) {
qWarning("LimeSDROutput::handleMessage: MsgGetDeviceInfo: cannot get GPIO pins values");
if ((m_deviceShared.m_deviceParams->m_type != DeviceLimeSDRParams::LimeMini)
&& (m_deviceShared.m_deviceParams->m_type != DeviceLimeSDRParams::LimeUndefined))
{
if (m_deviceShared.m_deviceParams->getDevice() && (LMS_GPIORead(m_deviceShared.m_deviceParams->getDevice(), &gpioPins, 1) != 0)) {
qDebug("LimeSDROutput::handleMessage: MsgGetDeviceInfo: cannot get GPIO pins values");
}
}
// send to oneself
if (m_deviceAPI->getSampleSourceGUIMessageQueue())
if (m_deviceAPI->getSampleSourceGUIMessageQueue())
{
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp, gpioPins);
m_deviceAPI->getSampleSourceGUIMessageQueue()->push(report);
@@ -1106,29 +1110,33 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
}
}
if ((m_settings.m_gpioDir != settings.m_gpioDir) || force)
if ((m_deviceShared.m_deviceParams->m_type != DeviceLimeSDRParams::LimeMini)
&& (m_deviceShared.m_deviceParams->m_type != DeviceLimeSDRParams::LimeUndefined))
{
if (LMS_GPIODirWrite(m_deviceShared.m_deviceParams->getDevice(), &settings.m_gpioDir, 1) != 0)
if ((m_settings.m_gpioDir != settings.m_gpioDir) || force)
{
qCritical("LimeSDROutput::applySettings: could not set GPIO directions to %u", settings.m_gpioDir);
if (LMS_GPIODirWrite(m_deviceShared.m_deviceParams->getDevice(), &settings.m_gpioDir, 1) != 0)
{
qCritical("LimeSDROutput::applySettings: could not set GPIO directions to %u", settings.m_gpioDir);
}
else
{
forwardGPIOChange = true;
qDebug("LimeSDROutput::applySettings: GPIO directions set to %u", settings.m_gpioDir);
}
}
else
{
forwardGPIOChange = true;
qDebug("LimeSDROutput::applySettings: GPIO directions set to %u", settings.m_gpioDir);
}
}
if ((m_settings.m_gpioPins != settings.m_gpioPins) || force)
{
if (LMS_GPIOWrite(m_deviceShared.m_deviceParams->getDevice(), &settings.m_gpioPins, 1) != 0)
if ((m_settings.m_gpioPins != settings.m_gpioPins) || force)
{
qCritical("LimeSDROutput::applySettings: could not set GPIO pins to %u", settings.m_gpioPins);
}
else
{
forwardGPIOChange = true;
qDebug("LimeSDROutput::applySettings: GPIO pins set to %u", settings.m_gpioPins);
if (LMS_GPIOWrite(m_deviceShared.m_deviceParams->getDevice(), &settings.m_gpioPins, 1) != 0)
{
qCritical("LimeSDROutput::applySettings: could not set GPIO pins to %u", settings.m_gpioPins);
}
else
{
forwardGPIOChange = true;
qDebug("LimeSDROutput::applySettings: GPIO pins set to %u", settings.m_gpioPins);
}
}
}