Seems I've pretty much got the F7 working now. There is still something weird with the ADC not returning the right value.. Also, the screen looks shimmery if viewed from the right angle. I've never noticed it before. Not sure if that's the F7's fault? Saving here so I can try the F4 again to compare.
This commit is contained in:
parent
ac513eaae0
commit
acefe9aa46
5 changed files with 98 additions and 52 deletions
25
Source/.settings/language.settings.xml
Normal file
25
Source/.settings/language.settings.xml
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project>
|
||||
<configuration id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.debug.1973458297" name="Debug">
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-12953173521901507" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
</extension>
|
||||
</configuration>
|
||||
<configuration id="ilg.gnuarmeclipse.managedbuild.cross.config.elf.release.1950335458" name="Release">
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="5998203251556263" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
</extension>
|
||||
</configuration>
|
||||
</project>
|
|
@ -162,6 +162,7 @@ extern const Gpio_Pin I2C_SDA;
|
|||
extern const Gpio_Pin FLIP_FLOP_ENABLE;
|
||||
|
||||
extern const Gpio_Pin RED_LED;
|
||||
extern const Gpio_Pin FIVE_VOLT_REGULATOR_ENABLE;
|
||||
|
||||
// extern const Gpio_Pin NC_1;
|
||||
// extern const Gpio_Pin DAC_SWITCHES;
|
||||
|
|
|
@ -124,12 +124,14 @@ void initAdc()
|
|||
|
||||
void adcGetConversion()
|
||||
{
|
||||
HAL_StatusTypeDef result = HAL_ADC_PollForConversion(&AdcHandle1, 10);
|
||||
result = HAL_ADC_PollForConversion(&AdcHandle2, 10);
|
||||
result = HAL_ADC_PollForConversion(&AdcHandle3, 10);
|
||||
HAL_StatusTypeDef result = HAL_ADC_PollForConversion(&AdcHandle1, 100);
|
||||
result = HAL_ADC_PollForConversion(&AdcHandle2, 100);
|
||||
result = HAL_ADC_PollForConversion(&AdcHandle3, 100);
|
||||
|
||||
if (result == HAL_OK)
|
||||
{
|
||||
//while(HAL_ADC_GetState(&AdcHandle1) != HAL_ADC_STATE_REG_EOC);
|
||||
|
||||
/* Check if the continous conversion of regular channel is finished */
|
||||
if(HAL_ADC_GetState(&AdcHandle1) == 0x300 /*HAL_ADC_STATE_REG_EOC*/
|
||||
&& HAL_ADC_GetState(&AdcHandle2) == 0x300 /*HAL_ADC_STATE_REG_EOC*/
|
||||
|
|
|
@ -202,6 +202,9 @@ const Gpio_Pin FLIP_FLOP_ENABLE =
|
|||
const Gpio_Pin RED_LED =
|
||||
{ GPIOE, GPIO_PIN_13 };
|
||||
|
||||
const Gpio_Pin FIVE_VOLT_REGULATOR_ENABLE =
|
||||
{ GPIOE, GPIO_PIN_2 };
|
||||
|
||||
//// timer pins
|
||||
//const Timer_Pin LED_G =
|
||||
//{
|
||||
|
@ -868,6 +871,13 @@ hal_setupPins (void)
|
|||
gpioInitStructure.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init (FLIP_FLOP_ENABLE.port, &gpioInitStructure);
|
||||
HAL_GPIO_WritePin (FLIP_FLOP_ENABLE.port, TRX_SWITCH.pin, 0);
|
||||
|
||||
gpioInitStructure.Pin = FIVE_VOLT_REGULATOR_ENABLE.pin;
|
||||
gpioInitStructure.Speed = GPIO_SPEED_LOW;
|
||||
gpioInitStructure.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
gpioInitStructure.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init (FIVE_VOLT_REGULATOR_ENABLE.port, &gpioInitStructure);
|
||||
HAL_GPIO_WritePin (FIVE_VOLT_REGULATOR_ENABLE.port, FIVE_VOLT_REGULATOR_ENABLE.pin, 0);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -1337,67 +1337,74 @@ void updateDisplay(uint8_t force)
|
|||
displayUpdating = 0;
|
||||
}
|
||||
|
||||
int newWaterFallData = 0;
|
||||
void drawWaterfall()
|
||||
{
|
||||
static float magnitudes[FFT_SIZE];
|
||||
static float mags;
|
||||
static uint8_t waterfallScanLine = 0;
|
||||
if(newWaterFallData == 1)
|
||||
{
|
||||
static float magnitudes[FFT_SIZE];
|
||||
static float mags;
|
||||
static uint8_t waterfallScanLine = 0;
|
||||
|
||||
unsigned short *gradient;
|
||||
unsigned short *gradient;
|
||||
|
||||
if(transmitting)
|
||||
gradient = &bitmapIronGradient;
|
||||
else
|
||||
gradient = &bitmapWebSdrGradient;
|
||||
if(transmitting)
|
||||
gradient = &bitmapIronGradient;
|
||||
else
|
||||
gradient = &bitmapWebSdrGradient;
|
||||
|
||||
//arm_cmplx_mag_f32(samplesDisplay, magnitudes, FFT_SIZE);
|
||||
arm_cmplx_mag_f32(samplesDisplay, magnitudes, FFT_SIZE);
|
||||
//arm_cmplx_mag_f32(samplesDisplay, magnitudes, FFT_SIZE);
|
||||
arm_cmplx_mag_f32(samplesDisplay, magnitudes, FFT_SIZE);
|
||||
|
||||
float fftMax = 0; //AH! These are being reset each time! Static makes them persistant right? Does it also ensure they are
|
||||
float fftMin = 100; //only initialized once? Have to try it when I get home. It would certainly be nice if the waterfall
|
||||
static float fftMaxMax = 0; //didn't change in brightness so much. Later, I may want to fix these values, or at least, make them
|
||||
static float logMax; //manually controllable, sorta, you know?
|
||||
uint8_t i;
|
||||
for(i = 1; i < 255; i++) //If bin 0 is the DC offset, should we skip it in this calculation?
|
||||
{
|
||||
float mags = magnitudes[i];
|
||||
if(mags > fftMax) fftMax = mags;
|
||||
if(mags < fftMin) fftMin = mags;
|
||||
}
|
||||
//logMax = log2(fftMax);
|
||||
float fftMax = 0; //AH! These are being reset each time! Static makes them persistant right? Does it also ensure they are
|
||||
float fftMin = 100; //only initialized once? Have to try it when I get home. It would certainly be nice if the waterfall
|
||||
static float fftMaxMax = 0; //didn't change in brightness so much. Later, I may want to fix these values, or at least, make them
|
||||
static float logMax; //manually controllable, sorta, you know?
|
||||
uint8_t i;
|
||||
for(i = 1; i < 255; i++) //If bin 0 is the DC offset, should we skip it in this calculation?
|
||||
{
|
||||
float mags = magnitudes[i];
|
||||
if(mags > fftMax) fftMax = mags;
|
||||
if(mags < fftMin) fftMin = mags;
|
||||
}
|
||||
//logMax = log2(fftMax);
|
||||
|
||||
if(fftMax > fftMaxMax) fftMaxMax += fftMax * 0.1;
|
||||
logMax = log2(fftMaxMax);
|
||||
fftMaxMax *= 0.99;
|
||||
if (fftMaxMax > fftMaxMaxMax) fftMaxMax = fftMaxMaxMax;
|
||||
if (fftMaxMax < fftMaxMaxMin) fftMaxMax = fftMaxMaxMin;
|
||||
if(fftMax > fftMaxMax) fftMaxMax += fftMax * 0.1;
|
||||
logMax = log2(fftMaxMax);
|
||||
fftMaxMax *= 0.99;
|
||||
if (fftMaxMax > fftMaxMaxMax) fftMaxMax = fftMaxMaxMax;
|
||||
if (fftMaxMax < fftMaxMaxMin) fftMaxMax = fftMaxMaxMin;
|
||||
|
||||
|
||||
// TODO: Got rid of the first bin because it's just DC offset, right?
|
||||
// but now narrow signal can disappear when they are right at the center....
|
||||
// Will that be better when I lower the sample frequency? Maybe I should do that next.
|
||||
// TODO: Got rid of the first bin because it's just DC offset, right?
|
||||
// but now narrow signal can disappear when they are right at the center....
|
||||
// Will that be better when I lower the sample frequency? Maybe I should do that next.
|
||||
|
||||
Adafruit_ILI9340_setAddrWindow(waterfallScanLine, 0, waterfallScanLine, 120);
|
||||
for(i = 120; i != 0; i--)
|
||||
{
|
||||
mags = (log2(magnitudes[i] + 1)) / fftMaxMax * 100; //Log needs to be at least 1 right? We could do a + (1-fftMin) maybe? Worth it?
|
||||
//mags = magnitudes[i] / fftMaxMax * 32;
|
||||
//Adafruit_ILI9340_drawPixel(waterfallScanLine, (120 - i), gradient[(uint8_t) mags]);
|
||||
Adafruit_ILI9340_pushColor(gradient[(uint8_t) mags]);
|
||||
}
|
||||
Adafruit_ILI9340_setAddrWindow(waterfallScanLine, 0, waterfallScanLine, 120);
|
||||
for(i = 120; i != 0; i--)
|
||||
{
|
||||
mags = (log2(magnitudes[i] + 1)) / fftMaxMax * 100; //Log needs to be at least 1 right? We could do a + (1-fftMin) maybe? Worth it?
|
||||
//mags = magnitudes[i] / fftMaxMax * 32;
|
||||
//Adafruit_ILI9340_drawPixel(waterfallScanLine, (120 - i), gradient[(uint8_t) mags]);
|
||||
Adafruit_ILI9340_pushColor(gradient[(uint8_t) mags]);
|
||||
}
|
||||
|
||||
Adafruit_ILI9340_setAddrWindow(waterfallScanLine, 120, waterfallScanLine, 239);
|
||||
for(i = 255; i > 135; i--)
|
||||
{
|
||||
mags = (log2(magnitudes[i] + 1)) / fftMaxMax * 100;
|
||||
//mags = magnitudes[i] / fftMaxMax * 32;
|
||||
//Adafruit_ILI9340_drawPixel(waterfallScanLine, 359 - (i - 15), gradient[(uint8_t) mags]);
|
||||
Adafruit_ILI9340_pushColor(gradient[(uint8_t) mags]);
|
||||
}
|
||||
Adafruit_ILI9340_setAddrWindow(waterfallScanLine, 120, waterfallScanLine, 239);
|
||||
for(i = 255; i > 135; i--)
|
||||
{
|
||||
mags = (log2(magnitudes[i] + 1)) / fftMaxMax * 100;
|
||||
//mags = magnitudes[i] / fftMaxMax * 32;
|
||||
//Adafruit_ILI9340_drawPixel(waterfallScanLine, 359 - (i - 15), gradient[(uint8_t) mags]);
|
||||
Adafruit_ILI9340_pushColor(gradient[(uint8_t) mags]);
|
||||
}
|
||||
|
||||
waterfallScanLine++;
|
||||
if(waterfallScanLine > 119) waterfallScanLine = 0;
|
||||
Adafruit_ILI9340_setVertialScrollStartAddress((/*119 -*/ waterfallScanLine) /*+ 200*/);
|
||||
|
||||
newWaterFallData = 0;
|
||||
}
|
||||
|
||||
waterfallScanLine++;
|
||||
if(waterfallScanLine > 119) waterfallScanLine = 0;
|
||||
Adafruit_ILI9340_setVertialScrollStartAddress((/*119 -*/ waterfallScanLine) /*+ 200*/);
|
||||
}
|
||||
|
||||
void fillSamepleWithTone(int tone, float *samples)
|
||||
|
@ -1552,6 +1559,7 @@ void processStream()
|
|||
|
||||
//blink_led_off();
|
||||
sampleRun = 0;
|
||||
newWaterFallData = 1;
|
||||
}
|
||||
|
||||
//clearTimUpdateFlag(&TimHandle4);
|
||||
|
|
Loading…
Reference in a new issue