[refactor] prepare for link gen
This commit is contained in:
@@ -74,7 +74,7 @@ static void _blinkButtons(GFX_display_t *disp, APP_data_t *app_data)
|
||||
BITMAP_buttonName_t bitmap_idx;
|
||||
for (LAY_dispBtn_t btn_idx = DISP_BTN_1; btn_idx < DISP_BTN_MAX; btn_idx++)
|
||||
{
|
||||
if (!(app_data->isButtonBlink & (1 << btn_idx)))
|
||||
if (!(app_data->button_blink & (1 << btn_idx)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ static void _blinkButtons(GFX_display_t *disp, APP_data_t *app_data)
|
||||
else
|
||||
{
|
||||
DISP_drawBitmap(disp, &bitmap_btnBottom[bitmap_idx], btn_pos_x[btn_idx], 53, BM_NORMAL);
|
||||
app_data->isButtonBlink &= ~(1 << btn_idx);
|
||||
app_data->button_blink &= ~(1 << btn_idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ static void _drawButtons(GFX_display_t *disp, APP_data_t *app_data)
|
||||
DISP_drawBitmap(disp, &bitmap_btnBottom[bitmap_idx], btn_pos_x[btn_idx], 53, BM_NORMAL);
|
||||
}
|
||||
|
||||
app_data->isButtonChange = 0;
|
||||
app_data->disp_update &= ~(UPDATE_BUTTON);
|
||||
}
|
||||
|
||||
static uint8_t _calcMarkerPos(uint32_t value, uint32_t max)
|
||||
@@ -180,24 +180,24 @@ static void _drawPhaseValueHelper(GFX_display_t *disp, uint32_t phase, uint8_t f
|
||||
|
||||
static void _drawFuncGenValues(GFX_display_t *disp, APP_data_t *app_data)
|
||||
{
|
||||
GEN_fg_t *fun_gen = (GEN_fg_t *)app_data->curr_gen;
|
||||
dds_gen_t *fun_gen = (dds_gen_t *)app_data->curr_gen;
|
||||
switch (app_data->curr_state_lay)
|
||||
{
|
||||
case LAY_FREQ:
|
||||
_drawFreqValueHelper(disp, fun_gen->frequency, app_data->freq_focus_digit);
|
||||
_drawMeterHelper(disp, "1", "1M", _calcMarkerPos(fun_gen->frequency, MAX_FREQ));
|
||||
_drawFreqValueHelper(disp, fun_gen->settings.frequency, app_data->freq_focus_digit);
|
||||
_drawMeterHelper(disp, "1", "1M", _calcMarkerPos(fun_gen->settings.frequency, MAX_FREQ));
|
||||
break;
|
||||
case LAY_AMPL:
|
||||
_drawAmplValueHelper(disp, fun_gen->amplitude, app_data->ampl_focus_digit);
|
||||
_drawMeterHelper(disp, "0V", "5V", _calcMarkerPos(fun_gen->amplitude, MAX_VOLT_POS));
|
||||
_drawAmplValueHelper(disp, fun_gen->settings.amplitude, app_data->ampl_focus_digit);
|
||||
_drawMeterHelper(disp, "0V", "5V", _calcMarkerPos(fun_gen->settings.amplitude, MAX_VOLT_POS));
|
||||
break;
|
||||
case LAY_OFFS:
|
||||
_drawOffsValueHelper(disp, fun_gen->offset, app_data->offs_focus_digit);
|
||||
_drawMeterHelper(disp, "-5V", "+5V", _calcMarkerPos(MAX_VOLT_POS + fun_gen->offset, MAX_VOLT_POS * 2));
|
||||
_drawOffsValueHelper(disp, fun_gen->settings.offset, app_data->offs_focus_digit);
|
||||
_drawMeterHelper(disp, "-5V", "+5V", _calcMarkerPos(MAX_VOLT_POS + fun_gen->settings.offset, MAX_VOLT_POS * 2));
|
||||
break;
|
||||
case LAY_PHAS:
|
||||
_drawPhaseValueHelper(disp, fun_gen->phase, app_data->phas_focus_digit);
|
||||
_drawMeterHelper(disp, "0", "360", _calcMarkerPos(fun_gen->phase, MAX_PHAS));
|
||||
_drawPhaseValueHelper(disp, fun_gen->settings.phase, app_data->phas_focus_digit);
|
||||
_drawMeterHelper(disp, "0", "360", _calcMarkerPos(fun_gen->settings.phase, MAX_PHAS));
|
||||
break;
|
||||
case LAY_MAIN:
|
||||
DISP_clearRegion(disp, 62, 13, 66, 40);
|
||||
@@ -206,10 +206,10 @@ static void _drawFuncGenValues(GFX_display_t *disp, APP_data_t *app_data)
|
||||
DISP_writeString(disp, &font5x7Info, (uint8_t *)"O:", 64, 33, BM_NORMAL);
|
||||
DISP_writeString(disp, &font5x7Info, (uint8_t *)"P:", 64, 43, BM_NORMAL);
|
||||
|
||||
_drawFreqValue(disp, fun_gen->frequency, 13);
|
||||
_drawAmplValue(disp, fun_gen->amplitude, 23);
|
||||
_drawOffsValue(disp, fun_gen->offset, 33);
|
||||
_drawPhasValue(disp, fun_gen->phase, 43);
|
||||
_drawFreqValue(disp, fun_gen->settings.frequency, 13);
|
||||
_drawAmplValue(disp, fun_gen->settings.amplitude, 23);
|
||||
_drawOffsValue(disp, fun_gen->settings.offset, 33);
|
||||
_drawPhasValue(disp, fun_gen->settings.phase, 43);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -226,7 +226,7 @@ static void _drawPwmGenValues(GFX_display_t *disp, APP_data_t *app_data)
|
||||
static void _drawValues(GFX_display_t *disp, APP_data_t *app_data)
|
||||
{
|
||||
// input: frequency(value), amplitiude(value), offset(value), phase(value), duty(value), invert(info), position(value)
|
||||
switch (app_data->curr_gen_type)
|
||||
switch (app_data->curr_gen->type)
|
||||
{
|
||||
case GEN_FG_TYPE:
|
||||
_drawFuncGenValues(disp, app_data);
|
||||
@@ -239,7 +239,7 @@ static void _drawValues(GFX_display_t *disp, APP_data_t *app_data)
|
||||
break;
|
||||
}
|
||||
|
||||
app_data->isValueChange = 0;
|
||||
app_data->disp_update &= ~(UPDATE_VALUE);
|
||||
}
|
||||
|
||||
static void _drawOffsetLine(GFX_display_t *disp, int16_t offs, uint32_t ampl)
|
||||
@@ -264,26 +264,26 @@ static void _drawOffsetLine(GFX_display_t *disp, int16_t offs, uint32_t ampl)
|
||||
|
||||
static void _drawFunGenGraph(GFX_display_t *disp, APP_data_t *app_data)
|
||||
{
|
||||
GEN_fg_t *fun_gen = (GEN_fg_t *)app_data->curr_gen;
|
||||
dds_gen_t *fun_gen = (dds_gen_t *)app_data->curr_gen;
|
||||
DISP_clearRegion(disp, 3, 12, 57, 40);
|
||||
|
||||
switch (fun_gen->wave)
|
||||
switch (fun_gen->settings.wave)
|
||||
{
|
||||
case GEN_SIN:
|
||||
DISP_drawBitmapShift(disp, &wave[WAVE_SIN], 6, 19, _calcPhaseShiftInPxl(fun_gen->phase, 360), BM_NORMAL);
|
||||
DISP_drawBitmapShift(disp, &wave[WAVE_SIN], 6, 19, _calcPhaseShiftInPxl(fun_gen->settings.phase, 360), BM_NORMAL);
|
||||
break;
|
||||
case GEN_TRI:
|
||||
DISP_drawBitmapShift(disp, &wave[WAVE_TRI], 6, 19, _calcPhaseShiftInPxl(fun_gen->phase, 360), BM_NORMAL);
|
||||
DISP_drawBitmapShift(disp, &wave[WAVE_TRI], 6, 19, _calcPhaseShiftInPxl(fun_gen->settings.phase, 360), BM_NORMAL);
|
||||
break;
|
||||
case GEN_SQR:
|
||||
DISP_drawBitmapShift(disp, &wave[WAVE_SQR], 6, 19, _calcPhaseShiftInPxl(fun_gen->phase, 360), BM_NORMAL);
|
||||
DISP_drawBitmapShift(disp, &wave[WAVE_SQR], 6, 19, _calcPhaseShiftInPxl(fun_gen->settings.phase, 360), BM_NORMAL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_drawOffsetLine(disp, fun_gen->offset, fun_gen->amplitude);
|
||||
// _drawMaxAmpLine(disp, fun_gen->offset, fun_gen->amplitude);
|
||||
_drawOffsetLine(disp, fun_gen->settings.offset, fun_gen->settings.amplitude);
|
||||
// _drawMaxAmpLine(disp, fun_gen->settings.offset, fun_gen->settings.amplitude);
|
||||
}
|
||||
static void _drawPwmGenGraph(GFX_display_t *disp, APP_data_t *app_data)
|
||||
{
|
||||
@@ -294,7 +294,7 @@ static void _drawGraph(GFX_display_t *disp, APP_data_t *app_data)
|
||||
// input: graph type(sin, triangle, squere, pwm), frequency(info), amplitiude(value), offset(value), phase(value), invert(pwm),
|
||||
DISP_drawVerticalLine(disp, 2, 12, 40, GFX_WHITE);
|
||||
|
||||
switch (app_data->curr_gen_type)
|
||||
switch (app_data->curr_gen->type)
|
||||
{
|
||||
case GEN_FG_TYPE:
|
||||
_drawFunGenGraph(disp, app_data);
|
||||
@@ -307,7 +307,7 @@ static void _drawGraph(GFX_display_t *disp, APP_data_t *app_data)
|
||||
break;
|
||||
}
|
||||
|
||||
app_data->isGraphChange = 0;
|
||||
app_data->disp_update &= ~(UPDATE_GRAPH);
|
||||
}
|
||||
|
||||
static void _drawChannels(GFX_display_t *disp, APP_data_t *app_data)
|
||||
@@ -321,23 +321,23 @@ static void _drawChannels(GFX_display_t *disp, APP_data_t *app_data)
|
||||
DISP_writeString(disp, &font5x7Info, (uint8_t *)"CH6", 107, 2, CHANNEL6 == app_data->curr_channel ? BM_INVERSE : BM_NORMAL);
|
||||
DISP_drawHorizontalLine(disp, 0, 10, 127, GFX_WHITE);
|
||||
|
||||
app_data->isChannelChange = 0;
|
||||
app_data->disp_update &= ~(UPDATE_CHANNEL);
|
||||
}
|
||||
|
||||
void LAY_drawDisplayLayout(GFX_display_t *disp, APP_data_t *app_data)
|
||||
{
|
||||
if (app_data->isChannelChange)
|
||||
if (app_data->disp_update & UPDATE_CHANNEL)
|
||||
_drawChannels(disp, app_data);
|
||||
|
||||
if (app_data->isValueChange)
|
||||
if (app_data->disp_update & UPDATE_VALUE)
|
||||
_drawValues(disp, app_data);
|
||||
|
||||
if (app_data->isGraphChange)
|
||||
if (app_data->disp_update & UPDATE_GRAPH)
|
||||
_drawGraph(disp, app_data);
|
||||
|
||||
if (app_data->isButtonChange)
|
||||
if (app_data->disp_update & UPDATE_BUTTON)
|
||||
_drawButtons(disp, app_data);
|
||||
|
||||
if (app_data->isButtonBlink)
|
||||
if (app_data->button_blink)
|
||||
_blinkButtons(disp, app_data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user