add save/recall feature

This commit is contained in:
TT 2016-10-16 20:02:38 +09:00
parent 09c99564f6
commit 0fe058aca7
4 changed files with 71 additions and 8 deletions

View file

@ -100,7 +100,8 @@ include $(CHIBIOS)/os/hal/lib/streams/streams.mk
include $(CHIBIOS)/os/various/shell/shell.mk
# Define linker script file here
LDSCRIPT= $(STARTUPLD)/STM32F072xB.ld
#LDSCRIPT= $(STARTUPLD)/STM32F072xB.ld
LDSCRIPT= STM32F072xB.ld
CMSIS = CMSIS
DSPLIBINC = ${CMSIS}/Include
@ -119,7 +120,7 @@ CSRC = $(STARTUPSRC) \
$(SHELLSRC) \
$(DSPLIBSRC) \
usbcfg.c \
main.c si5351.c si5351_low.c tlv320aic3204.c dsp.c ili9431.c numfont20x24.c Font5x7.c
main.c si5351.c si5351_low.c tlv320aic3204.c dsp.c ili9431.c numfont20x24.c Font5x7.c flash.c
# $(TESTSRC) \

View file

@ -420,7 +420,7 @@ ili9341_test(int mode)
int prev_x;
//int prev_x;
int32_t fstart = 0;
int32_t fstop = 300000000;

46
main.c
View file

@ -216,10 +216,6 @@ int16_t dump_selection = 0;
int16_t dsp_disabled = FALSE;
float measured[2][101][2];
uint32_t frequencies[101];
uint16_t cal_status;
float cal_data[5][101][2];
@ -311,11 +307,30 @@ static void cmd_gamma(BaseSequentialStream *chp, int argc, char *argv[])
chprintf(chp, "%d %d\r\n", gamma[0], gamma[1]);
}
#if 0
int32_t freq_start = 1000000;
int32_t freq_stop = 300000000;
int16_t sweep_points = 101;
uint32_t frequencies[101];
uint16_t cal_status;
float cal_data[5][101][2];
#endif
config_t current_config = {
/* magic */ CONFIG_MAGIC,
/* freq_start */ 1000000,
/* freq_stop */ 300000000,
/* sweep_points */ 101,
/* cal_status */ 0,
/* frequencies */ {},
/* cal_data */ {},
/* checksum */ 0
};
config_t *active = &current_config;
static void cmd_scan(BaseSequentialStream *chp, int argc, char *argv[])
{
float gamma[2];
@ -653,6 +668,22 @@ static void cmd_cal(BaseSequentialStream *chp, int argc, char *argv[])
}
}
static void cmd_save(BaseSequentialStream *chp, int argc, char *argv[])
{
(void)chp;
(void)argc;
(void)argv;
caldata_save();
}
static void cmd_recall(BaseSequentialStream *chp, int argc, char *argv[])
{
(void)chp;
(void)argc;
(void)argv;
caldata_recall();
}
static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[])
{
int i;
@ -777,6 +808,8 @@ static const ShellCommand commands[] =
{ "pause", cmd_pause },
{ "resume", cmd_resume },
{ "cal", cmd_cal },
{ "save", cmd_save },
{ "recall", cmd_recall },
{ NULL, NULL }
};
@ -829,6 +862,9 @@ int main(void)
* SPI LCD Initialize
*/
ili9341_init();
caldata_recall();
set_sweep(freq_start, freq_stop);
redraw();

View file

@ -87,3 +87,29 @@ void draw_cell_all(void);
extern const uint16_t x5x7_bits [];
extern const uint32_t numfont20x24[][24];
int caldata_save(void);
int caldata_recall(void);
typedef struct {
int32_t magic;
int32_t _freq_start;
int32_t _freq_stop;
int16_t _sweep_points;
uint16_t _cal_status;
uint32_t _frequencies[101];
float _cal_data[5][101][2];
int32_t checksum;
} config_t;
#define CONFIG_MAGIC 0x436f4e45 /* 'CoNF' */
extern config_t *active;
extern config_t current_config;
#define freq_start active->_freq_start
#define freq_stop active->_freq_stop
#define sweep_points active->_sweep_points
#define cal_status active->_cal_status
#define frequencies active->_frequencies
#define cal_data active->_cal_data