Created 'wrappers' subfolder in platform/drivers/baseband containing the C wrappers for the AT1846S, HR_C5000 and HR_C6000 drivers

replace/fe2367ccf253e6d9d713df225c730d054eb219ab
Silvano Seva 2021-04-15 22:36:36 +02:00
rodzic 11161fa64a
commit 887d95ec58
6 zmienionych plików z 343 dodań i 5 usunięć

Wyświetl plik

@ -18,8 +18,7 @@
* along with this program; if not, see <http://www.gnu.org/licenses/> *
***************************************************************************/
#include <interfaces/delays.h>
#include "new/AT1846S.h"
#include "AT1846S_wrapper.h"
#include "AT1846S.h"
void AT1846S_init()

Wyświetl plik

@ -18,8 +18,8 @@
* along with this program; if not, see <http://www.gnu.org/licenses/> *
***************************************************************************/
#ifndef AT1846S_H
#define AT1846S_H
#ifndef AT1846S_WRAPPER_H
#define AT1846S_WRAPPER_H
#include <stdint.h>
#include <stdbool.h>
@ -186,4 +186,4 @@ void AT1846S_setAnalogSqlThresh(const uint8_t thresh);
}
#endif
#endif /* AT1846S_H */
#endif /* AT1846S_WRAPPER_H */

Wyświetl plik

@ -0,0 +1,68 @@
/***************************************************************************
* Copyright (C) 2021 by Federico Amedeo Izzo IU2NUO, *
* Niccolò Izzo IU2KIN *
* Frederik Saraci IU2NRO *
* Silvano Seva IU2KWO *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, see <http://www.gnu.org/licenses/> *
***************************************************************************/
#include "HR_C5000_wrapper.h"
#include "HR_C5000.h"
void C5000_init()
{
HR_C5000::instance().init();
}
void C5000_terminate()
{
HR_C5000::instance().terminate();
}
void C5000_setModOffset(uint8_t offset)
{
HR_C5000::instance().setModOffset(offset);
}
void C5000_setModAmplitude(uint8_t iAmp, uint8_t qAmp)
{
HR_C5000::instance().setModAmplitude(iAmp, qAmp);
}
void C5000_setModFactor(uint8_t mf)
{
HR_C5000::instance().setModFactor(mf);
}
void C5000_dmrMode()
{
HR_C5000::instance().dmrMode();
}
void C5000_fmMode()
{
HR_C5000::instance().fmMode();
}
void C5000_startAnalogTx()
{
HR_C5000::instance().startAnalogTx(TxAudioSource::MIC, FmConfig::PREEMPH_EN |
FmConfig::BW_25kHz);
}
void C5000_stopAnalogTx()
{
HR_C5000::instance().stopAnalogTx();
}

Wyświetl plik

@ -0,0 +1,96 @@
/***************************************************************************
* Copyright (C) 2021 by Federico Amedeo Izzo IU2NUO, *
* Niccolò Izzo IU2KIN *
* Frederik Saraci IU2NRO *
* Silvano Seva IU2KWO *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, see <http://www.gnu.org/licenses/> *
***************************************************************************/
#ifndef HRC5000_WRAPPER_H
#define HRC5000_WRAPPER_H
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Driver for HR_C5000 "baseband" chip.
*
* WARNING: on MD3x0 devices the PLL and DMR chips share the SPI MOSI line,
* thus particular care has to be put to avoid them stomping reciprocally.
* This driver does not make any check if a SPI transfer is already in progress,
* deferring the correct bus management to higher level modules. However,
* a function returning true if the bus is currently in use by this driver is
* provided.
*/
/**
* Initialise the HR_C5000 driver.
*/
void C5000_init();
/**
* Terminate the HR_C5000 driver.
*/
void C5000_terminate();
/**
* Set value for two-point modulation offset adjustment. This value usually is
* stored in radio calibration data.
* @param offset: value for modulation offset adjustment.
*/
void C5000_setModOffset(uint8_t offset);
/**
* Set values for two-point modulation amplitude adjustment. These values
* usually are stored in radio calibration data.
* @param iMag: value for modulation offset adjustment.
*/
void C5000_setModAmplitude(uint8_t iAmp, uint8_t qAmp);
/**
* Set value for FM-mode modulation factor, a value dependent on bandwidth.
* @param mf: value for FM modulation factor.
*/
void C5000_setModFactor(uint8_t mf);
/**
* Configure chipset for DMR operation.
*/
void C5000_dmrMode();
/**
* Configure chipset for analog FM operation.
*/
void C5000_fmMode();
/**
* Start analog FM transmission.
*/
void C5000_startAnalogTx();
/**
* Stop analog FM transmission.
*/
void C5000_stopAnalogTx();
#ifdef __cplusplus
}
#endif
#endif // HRC5000_WRAPPER_H

Wyświetl plik

@ -0,0 +1,78 @@
/***************************************************************************
* Copyright (C) 2021 by Federico Amedeo Izzo IU2NUO, *
* Niccolò Izzo IU2KIN *
* Frederik Saraci IU2NRO *
* Silvano Seva IU2KWO *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, see <http://www.gnu.org/licenses/> *
***************************************************************************/
#include "HR_C6000_wrapper.h"
#include "HR_C6000.h"
void C6000_init()
{
HR_C6000::instance().init();
}
void C6000_terminate()
{
HR_C6000::instance().terminate();
}
void C6000_setModOffset(uint16_t offset)
{
HR_C6000::instance().setModOffset(offset);
}
void C6000_setModAmplitude(uint8_t iAmp, uint8_t qAmp)
{
HR_C6000::instance().setModAmplitude(iAmp, qAmp);
}
void C6000_setMod2Bias(uint8_t bias)
{
HR_C6000::instance().writeCfgRegister(0x04, bias);
}
void C6000_setModFactor(uint8_t mf)
{
HR_C6000::instance().setModFactor(mf);
}
void C6000_setDacGain(uint8_t value)
{
HR_C6000::instance().setDacGain(value);
}
void C6000_dmrMode()
{
HR_C6000::instance().dmrMode();
}
void C6000_fmMode()
{
HR_C6000::instance().fmMode();
}
void C6000_startAnalogTx()
{
HR_C6000::instance().startAnalogTx(TxAudioSource::MIC, FmConfig::PREEMPH_EN |
FmConfig::BW_25kHz);
}
void C6000_stopAnalogTx()
{
HR_C6000::instance().stopAnalogTx();
}

Wyświetl plik

@ -0,0 +1,97 @@
/***************************************************************************
* Copyright (C) 2021 by Federico Amedeo Izzo IU2NUO, *
* Niccolò Izzo IU2KIN *
* Frederik Saraci IU2NRO *
* Silvano Seva IU2KWO *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, see <http://www.gnu.org/licenses/> *
***************************************************************************/
#ifndef HRC6000_WRAPPER_H
#define HRC6000_WRAPPER_H
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Initialise the HR_C6000 driver.
*/
void C6000_init();
/**
* Terminate the HR_C6000 driver.
*/
void C6000_terminate();
/**
* Set value for two-point modulation offset adjustment. This value usually is
* stored in radio calibration data.
* @param offset: value for modulation offset adjustment.
*/
void C6000_setModOffset(uint16_t offset);
/**
* Set values for two-point modulation amplitude adjustment. These values
* usually are stored in radio calibration data.
* @param iMag: value for modulation offset adjustment.
*/
void C6000_setModAmplitude(uint8_t iAmp, uint8_t qAmp);
/**
*
*/
void C6000_setMod2Bias(uint8_t bias);
/**
* Set value for FM-mode modulation factor, a value dependent on bandwidth.
* @param mf: value for FM modulation factor.
*/
void C6000_setModFactor(uint8_t mf);
/**
* Configure the gain of lineout DAC stage. Allowed range is 1 - 31 and each
* step corresponds to a variation of 1.5dB.
* @param value: gain for the DAC stage.
*/
void C6000_setDacGain(uint8_t value);
/**
* Configure chipset for DMR operation.
*/
void C6000_dmrMode();
/**
* Configure chipset for analog FM operation.
*/
void C6000_fmMode();
/**
* Start analog FM transmission.
*/
void C6000_startAnalogTx();
/**
* Stop analog FM transmission.
*/
void C6000_stopAnalogTx();
#ifdef __cplusplus
}
#endif
#endif // HRC6000_WRAPPER_H