kopia lustrzana https://github.com/OpenRTX/OpenRTX
CS7000P: added radio driver
rodzic
8625184030
commit
fb9dd20147
|
@ -522,11 +522,12 @@ cs7000p_src = ['platform/drivers/NVM/nvmem_CS7000.c',
|
|||
'platform/drivers/baseband/HR_C6000.cpp',
|
||||
'platform/drivers/baseband/HR_Cx000.cpp',
|
||||
'platform/drivers/baseband/HR_C6000_CS7000.cpp',
|
||||
'platform/drivers/baseband/radio_CS7000.cpp',
|
||||
'platform/drivers/baseband/AK2365A.c',
|
||||
'platform/drivers/baseband/SKY72310.c',
|
||||
'platform/drivers/audio/Cx000_dac.cpp',
|
||||
'platform/drivers/audio/audio_CS7000.cpp',
|
||||
'platform/drivers/stubs/cps_io_stub.c',
|
||||
'platform/drivers/stubs/radio_stub.c',
|
||||
'platform/drivers/stubs/radio_stub.c',
|
||||
'platform/drivers/display/ST7735R_CS7000.c',
|
||||
'platform/drivers/keyboard/keyboard_CS7000.c',
|
||||
'platform/drivers/backlight/backlight_CS7000.c',
|
||||
|
|
|
@ -96,7 +96,7 @@ void OpMode_M17::update(rtxStatus_t *const status, const bool newCfg)
|
|||
//
|
||||
invertTxPhase = (mod17CalData.bb_tx_invert == 1) ? true : false;
|
||||
invertRxPhase = (mod17CalData.bb_rx_invert == 1) ? true : false;
|
||||
#elif defined(PLATFORM_CS7000)
|
||||
#elif defined(PLATFORM_CS7000) || defined(PLATFORM_CS7000P)
|
||||
invertTxPhase = true;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -31,6 +31,10 @@
|
|||
#include "SKY72310.h"
|
||||
#include "AK2365A.h"
|
||||
|
||||
#ifdef PLATFORM_CS7000P
|
||||
#define DAC DAC1
|
||||
#endif
|
||||
|
||||
static constexpr uint32_t CTCSS_SAMPLE_RATE = 2000;
|
||||
static constexpr freq_t IF_FREQ = 49950000; // Intermediate frequency: 49.95MHz
|
||||
|
||||
|
@ -173,9 +177,14 @@ void radio_init(const rtxStatus_t *rtxState)
|
|||
/*
|
||||
* Configure and enable DAC
|
||||
*/
|
||||
#ifdef PLATFORM_CS7000P
|
||||
RCC->APB1LENR |= RCC_APB1LENR_DAC12EN;
|
||||
#else
|
||||
RCC->APB1ENR |= RCC_APB1ENR_DACEN;
|
||||
DAC->DHR12R1 = 0;
|
||||
DAC->CR |= DAC_CR_EN1;
|
||||
#endif
|
||||
|
||||
DAC->DHR12R1 = 0;
|
||||
DAC->CR |= DAC_CR_EN1;
|
||||
|
||||
spiBitbang_init(&det_spi);
|
||||
spiBitbang_init(&pll_spi);
|
||||
|
@ -210,7 +219,11 @@ void radio_terminate()
|
|||
AK2365A_terminate(&detector);
|
||||
|
||||
DAC->DHR12R1 = 0;
|
||||
#ifdef PLATFORM_CS7000P
|
||||
RCC->APB1LENR &= ~RCC_APB1LENR_DAC12EN;
|
||||
#else
|
||||
RCC->APB1ENR &= ~RCC_APB1ENR_DACEN;
|
||||
#endif
|
||||
}
|
||||
|
||||
void radio_setOpmode(const enum opmode mode)
|
||||
|
@ -313,7 +326,7 @@ void radio_enableTx()
|
|||
float pwrHi = static_cast< float >(txpwr_hi);
|
||||
float pwrLo = static_cast< float >(txpwr_lo);
|
||||
float apc = pwrLo + (pwrHi - pwrLo)/4.0f*(power - 1.0f);
|
||||
DAC->DHR8R1 = static_cast< uint8_t >(apc);
|
||||
DAC1->DHR8R1 = static_cast< uint8_t >(apc);
|
||||
|
||||
switch(config->opMode)
|
||||
{
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include <adc_stm32.h>
|
||||
#include <hwconfig.h>
|
||||
#include <pthread.h>
|
||||
#include <SKY72310.h>
|
||||
#include <AK2365A.h>
|
||||
|
||||
/**
|
||||
* SPI bitbang function for SN74HC595 gpio extender.
|
||||
|
@ -66,12 +68,46 @@ static uint8_t spiSr_func(const void *priv, uint8_t value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct spiConfig spiDetCfg =
|
||||
{
|
||||
.clk = { DET_CLK },
|
||||
.mosi = { DET_DAT },
|
||||
.miso = { DET_DAT },
|
||||
.clkPeriod = SCK_PERIOD_FROM_FREQ(1000000),
|
||||
.flags = SPI_HALF_DUPLEX
|
||||
};
|
||||
|
||||
static const struct spiConfig spiPllCfg =
|
||||
{
|
||||
.clk = { PLL_CLK },
|
||||
.mosi = { PLL_DAT },
|
||||
.miso = { PLL_DAT },
|
||||
.clkPeriod = SCK_PERIOD_FROM_FREQ(1000000),
|
||||
.flags = SPI_HALF_DUPLEX
|
||||
};
|
||||
|
||||
static const struct gpioPin shiftRegStrobe = { GPIOEXT_STR };
|
||||
static pthread_mutex_t adc1Mutex;
|
||||
static pthread_mutex_t c6000_mutex;
|
||||
|
||||
SPI_CUSTOM_DEVICE_DEFINE(spiSr, spiSr_func, NULL, NULL)
|
||||
SPI_BITBANG_DEVICE_DEFINE(det_spi, spiDetCfg, NULL)
|
||||
SPI_BITBANG_DEVICE_DEFINE(pll_spi, spiPllCfg, NULL)
|
||||
SPI_STM32_DEVICE_DEFINE(flash_spi, SPI4, NULL)
|
||||
SPI_STM32_DEVICE_DEFINE(c6000_spi, SPI2, &c6000_mutex)
|
||||
GPIO_SHIFTREG_DEVICE_DEFINE(extGpio, (const struct spiDevice *) &spiSr, shiftRegStrobe, 24)
|
||||
ADC_STM32_DEVICE_DEFINE(adc1, ADC1, &adc1Mutex, ADC_COUNTS_TO_UV(3300000, 16))
|
||||
|
||||
const struct ak2365a detector =
|
||||
{
|
||||
.spi = (const struct spiDevice *) &det_spi,
|
||||
.cs = { DET_CS },
|
||||
.res = { DET_RST }
|
||||
};
|
||||
|
||||
const struct sky73210 pll =
|
||||
{
|
||||
.spi = (const struct spiDevice *) &pll_spi,
|
||||
.cs = { PLL_CS },
|
||||
.refClk = 16800000
|
||||
};
|
||||
|
|
|
@ -43,6 +43,8 @@ enum AdcChannels
|
|||
|
||||
extern const struct Adc adc1;
|
||||
extern const struct spiCustomDevice spiSr;
|
||||
extern const struct spiCustomDevice det_spi;
|
||||
extern const struct spiCustomDevice pll_spi;
|
||||
extern const struct spiDevice flash_spi;
|
||||
extern const struct spiDevice c6000_spi;
|
||||
extern const struct gpioDev extGpio;
|
||||
|
|
Ładowanie…
Reference in New Issue