1
0
mirror of https://github.com/peterantypas/maiana.git synced 2025-05-27 21:00:24 -07:00
This commit is contained in:
Peter Antypas 2020-12-21 11:20:31 -08:00
parent a4fac54abe
commit 88d6537eb1
4 changed files with 27 additions and 48 deletions

View File

@ -22,46 +22,21 @@
#define TXPOWERSETTINGS_H_
#define MAX_TX_LEVEL 33;
#define MIN_TX_LEVEL 24;
#include <inttypes.h>
/*
* These settings were derived from conducted measurements using a calibrated HP8563E spectrum analyzer
*/
typedef enum {
PWR_P33,
PWR_P30,
PWR_P27,
PWR_P24
}
tx_power_level;
typedef struct {
tx_power_level level; // For convenience
//uint16_t part_id;
uint8_t pa_mode; // PA Mode
uint8_t pa_level; // PA power level (native parameter)
uint8_t pa_bias_clkduty; // PA bias clock duty
}
pa_params;
#if 1
static const pa_params POWER_TABLE[] = {
{PWR_P33, 0x48, 0x20, 0x00},
{PWR_P30, 0x48, 0x18, 0x00},
{PWR_P27, 0x49, 0x55, 0x1a},
{PWR_P24, 0x49, 0x50, 0x15}
};
#else
#if 0
static const pa_params POWER_TABLE[] = {
{0x4467, 0x48, 0x20, 0x00},
{0x4463, 0x48, 0x22, 0x00}
{0x4460, 0x48, 0x20, 0x00},
{0x4463, 0x48, 0x12, 0x00}
};
#endif
#endif /* TXPOWERSETTINGS_H_ */

View File

@ -54,8 +54,8 @@ protected:
virtual void configureGPIOsForRX();
private:
void startTransmitting();
void configureGPIOsForTX(tx_power_level pwr);
void setTXPower(tx_power_level pwr);
void configureGPIOsForTX();
void setTXPower(const pa_params &params);
void reportTXEvent();
private:
TXPacket *mTXPacket;

View File

@ -28,17 +28,6 @@
// Set to non-zero to enable transmission support
#define ENABLE_TX 1
#ifdef CALIBRATION_MODE
#define TX_POWER_LEVEL PWR_P33
#else
#ifdef TX_TEST_MODE
#define TX_POWER_LEVEL PWR_P33
#else
#define TX_POWER_LEVEL PWR_P33
#endif
#endif
/*
* Defining this symbol forces all output (NMEA + debug) to a high-speed USART for tunneling to an application that demuxes it.
* Multiplexed output is still ASCII, but every line of text begins with a message class in square brackets. Examples:

View File

@ -74,6 +74,23 @@ void Transceiver::configure()
p.StartProperty = 0x0f;
memcpy(p.Data, data, sizeof data);
sendCmd(SET_PROPERTY, &p, 12, NULL, 0);
pa_params pwr;
switch(mPartNumber)
{
case 0x4463:
pwr.pa_mode = 0x48;
pwr.pa_level = 0x12;
pwr.pa_bias_clkduty = 0x00;
break;
default:
pwr.pa_mode = 0x48;
pwr.pa_level = 0x20;
pwr.pa_bias_clkduty = 0x00;
break;
}
setTXPower(pwr);
}
void Transceiver::processEvent(const Event &e)
@ -91,7 +108,8 @@ void Transceiver::processEvent(const Event &e)
void Transceiver::transmitCW(VHFChannel channel)
{
startReceiving(channel, false);
configureGPIOsForTX(TX_POWER_LEVEL);
configureGPIOsForTX();
SET_PROPERTY_PARAMS p;
p.Group = 0x20;
p.NumProperties = 1;
@ -124,9 +142,8 @@ void Transceiver::transmitCW(VHFChannel channel)
#endif
}
void Transceiver::setTXPower(tx_power_level powerLevel)
void Transceiver::setTXPower(const pa_params &pwr)
{
const pa_params &pwr = POWER_TABLE[powerLevel];
SET_PROPERTY_PARAMS p;
p.Group = 0x22;
p.NumProperties = 3;
@ -138,7 +155,7 @@ void Transceiver::setTXPower(tx_power_level powerLevel)
}
void Transceiver::configureGPIOsForTX(tx_power_level powerLevel)
void Transceiver::configureGPIOsForTX()
{
bsp_set_tx_mode();
@ -151,8 +168,6 @@ void Transceiver::configureGPIOsForTX(tx_power_level powerLevel)
gpiocfg.SDO = 0x00; // No change
gpiocfg.GENCFG = 0x00; // No change
sendCmd(GPIO_PIN_CFG, &gpiocfg, sizeof gpiocfg, NULL, 0);
setTXPower(powerLevel);
}
void Transceiver::startListening(VHFChannel channel, bool reconfigGPIOs)
@ -282,7 +297,7 @@ void Transceiver::startTransmitting()
// Set TX power level
// Start transmitting
gRadioState = RADIO_TRANSMITTING;
configureGPIOsForTX(TX_POWER_LEVEL);
configureGPIOsForTX();
//ASSERT(false);