Ejemplo n.º 1
0
void doSetYawTrim(TouchButton * const aTheTouchedButton, int16_t aValue) {
    FeedbackToneOK();
    sYawTrimValue += aValue;
    snprintf(StringBuffer, sizeof StringBuffer, "% 3d", sYawTrimValue);
    BlueDisplay1.drawText(BUTTON_WIDTH_3_POS_2 + BUTTON_WIDTH_8 + TEXT_SIZE_11_WIDTH, BUTTON_HEIGHT_4_LINE_3 + TEXT_SIZE_22_HEIGHT,
            StringBuffer, TEXT_SIZE_11, COLOR_RED, COLOR_WHITE);
    TouchSliderHorizontal.setActualValueAndDraw(sYawValue + sYawTrimValue);
}
Ejemplo n.º 2
0
void doNew(TouchButton * const aTheTouchedButton, int16_t aValue) {
    FeedbackToneOK();
// deactivate gui elements
    TouchButton::deactivateAllButtons();
    TouchSlider::deactivateAllSliders();
    initNewGameOfLife();
    MillisSinceLastAction = GolDelay;
    GolRunning = true;
}
/**
 * gets frequency value from numberpad
 * @param aTheTouchedButton
 * @param aValue
 */
void doSetFrequency(TouchButton * const aTheTouchedButton, int16_t aValue) {
    FeedbackToneOK();
    float tNumber = getNumberFromNumberPad(NUMBERPAD_DEFAULT_X, 0, COLOR_BLUE);
    // check for cancel
    if (!isnan(tNumber)) {
        sFrequency = tNumber;
    }
    drawFreqGenPage();
    ComputePeriodAndSetTimer(true);
}
Ejemplo n.º 4
0
void doToggleSendReceive(TouchButton * const aTheTouchedButton, int16_t aValue) {
    FeedbackToneOK();
    sSend = !sSend;
    if (sSend) {
        aTheTouchedButton->setCaption(StringSend);
    } else {
        aTheTouchedButton->setCaption(StringReceive);
    }
    aTheTouchedButton->drawButton();
}
Ejemplo n.º 5
0
void doDACStop(TouchButton * const aTheTouchedButton, int16_t aValue) {
    FeedbackToneOK();
    aValue = !aValue;
    if (aValue) {
        aTheTouchedButton->setCaption(StringStop);
        DAC_Start();
    } else {
        DAC_Stop();
        aTheTouchedButton->setCaption(StringStart);
    }
    aTheTouchedButton->setRedGreenButtonColorAndDraw(aValue);
}
void doFreqGenStartStop(TouchButton * const aTheTouchedButton, int16_t aValue) {
    FeedbackToneOK();
    aValue = !aValue;
    if (aValue) {
        aTheTouchedButton->setCaption(StringStop);
        HIRES_Timer_Start();
    } else {
        aTheTouchedButton->setCaption(StringStart);
        HIRES_Timer_Stop();
    }
    aTheTouchedButton->setRedGreenButtonColorAndDraw(aValue);
}
Ejemplo n.º 7
0
void doContinue(TouchButton * const aTheTouchedButton, int16_t aValue) {
    FeedbackToneOK();
// deactivate gui elements
    TouchButton::deactivateAllButtons();
    TouchSlider::deactivateAllSliders();
    if (!GolInitialized) {
        initNewGameOfLife();
    } else {
        ClearScreenAndDrawGameOfLifeGrid();
    }
    MillisSinceLastAction = GolDelay;
    GolRunning = true;
}
Ejemplo n.º 8
0
void doADS7846Channels(TouchButton * const aTheTouchedButton, int16_t aValue) {
    FeedbackToneOK();
    TouchButton::deactivateAllButtons();
    mActualApplication = APPLICATION_ADS7846_CHANNELS;
    BlueDisplay1.clearDisplay(COLOR_DEMO_BACKGROUND);
    uint16_t tPosY = 30;
    // draw text
    for (uint8_t i = 0; i < 8; ++i) {
        BlueDisplay1.drawText(90, tPosY, (char *) ADS7846ChannelStrings[i], TEXT_SIZE_22, COLOR_RED, COLOR_DEMO_BACKGROUND);
        tPosY += TEXT_SIZE_22_HEIGHT;
    }
    TouchButtonBack->drawButton();
}
Ejemplo n.º 9
0
static void doChangeDACWaveform(TouchButton * const aTheTouchedButton, int16_t aValue) {
    FeedbackToneOK();
    sActualWaveform++;
    if (sActualWaveform == WAVEFORM_NOISE) {
        DAC_ModeNoise();
        DAC_Start();
    } else if (sActualWaveform > WAVEFORM_MAX) {
        sActualWaveform = WAVEFORM_TRIANGLE;
        DAC_ModeTriangle();
        DAC_Start();
    }
    aTheTouchedButton->setCaption(WaveformStrings[sActualWaveform]);
    aTheTouchedButton->drawButton();
}
Ejemplo n.º 10
0
void doIRButtons(TouchButton * const aTheTouchedButton, int16_t aValue) {
    FeedbackToneOK();
    if (aTheTouchedButton == TouchButtonsIRSend[0]) {
        sIRSendData.protocol = IRMP_NEC_PROTOCOL; // use NEC protocol
        sIRSendData.address = 64260; // set address LG 0XFB04
        sIRSendData.command = 0x00FF; // set command to EZ Adjust
        sIRSendData.flags = 0; // don't repeat frame
        //irsnd_send_data(&sIRSendData, TRUE); // send frame, wait for completion
        irsnd_send_data(&sIRSendData, FALSE); // send frame, do not wait for completion
    } else if (aTheTouchedButton == TouchButtonsIRSend[1]) {
        sIRSendData.protocol = IRMP_NEC_PROTOCOL; // use NEC protocol
        sIRSendData.address = 64260; // set address
        sIRSendData.command = 251; // set command to In  Start
        sIRSendData.flags = 0;
        irsnd_send_data(&sIRSendData, TRUE); // send frame, wait for completion
    } else if (aTheTouchedButton == TouchButtonsIRSend[2]) {
        float tNumber = getNumberFromNumberPad(NUMBERPAD_DEFAULT_X, 0, COLOR_GREEN);
        if (!isnan(tNumber) && tNumber != IN_STOP_CODE) {
            sCode = tNumber;
        }
        displayIRPage();
        assertParamMessage((sCode != IN_STOP_CODE), sCode, "");
        if (sCode != IN_STOP_CODE) {
            sIRSendData.protocol = IRMP_NEC_PROTOCOL; // use NEC protocol
            sIRSendData.address = 64260; // set address
            sIRSendData.command = sCode; // set command to
            sIRSendData.flags = 1; //  repeat frame once
            irsnd_send_data(&sIRSendData, TRUE); // send frame, wait for completion
        }
    } else if (aTheTouchedButton == TouchButtonsIRSend[3]) {
        sIRSendData.protocol = IRMP_NEC_PROTOCOL; // use NEC protocol
        sIRSendData.address = 64260; // set address
        sIRSendData.command = sCode; // set command to Volume -
        sIRSendData.flags = 0x0F; // repeat frame forever
        irsnd_send_data(&sIRSendData, FALSE); // send frame, do not wait for completion
        delayMillis(2000);
        irsnd_stop();
    }

    snprintf(StringBuffer, sizeof StringBuffer, "Cmd=%4d|%3X", sCode, sCode);
    BlueDisplay1.drawText(BUTTON_WIDTH_3_POS_2, BUTTON_HEIGHT_5_LINE_2 + TEXT_SIZE_22_HEIGHT, StringBuffer, TEXT_SIZE_22,
            COLOR_PAGE_INFO, COLOR_WHITE);
}
Ejemplo n.º 11
0
/**
 * Check if touch event is in button area
 * if yes - call callback function and return true
 * if no - return false
 */
bool TouchButton::checkButton(uint16_t aTouchPositionX, uint16_t aTouchPositionY) {
    if ((mFlags & FLAG_IS_ACTIVE) && mOnTouchHandler != NULL && checkButtonInArea(aTouchPositionX, aTouchPositionY)) {
        /*
         *  Touch position is in button - call callback function
         */
        if (mFlags & BUTTON_FLAG_DO_BEEP_ON_TOUCH) {
            FeedbackToneOK();
        }
#ifdef REMOTE_DISPLAY_SUPPORTED
        if ((mFlags & FLAG_USE_BDBUTTON_FOR_CALLBACK)
                && (&TouchButtonAutorepeat::autorepeatTouchHandler
                        != (void (*)(TouchButtonAutorepeat *, int16_t)) mOnTouchHandler)) {
            mOnTouchHandler((TouchButton *) this->mBDButtonPtr, mValue);
        } else {
            mOnTouchHandler(this, mValue);
        }
#else
        mOnTouchHandler(this, mValue);
#endif
        return true;
    }
    return false;
}
Ejemplo n.º 12
0
void doGuiDemoButtons(TouchButton * const aTheTouchedButton, int16_t aValue) {
    FeedbackToneOK();
    TouchButton::deactivateAllButtons();
    TouchSlider::deactivateAllSliders();
    if (aTheTouchedButton == TouchButtonChartDemo) {
        showCharts();
        return;
    }

#ifdef LOCAL_DISPLAY_EXISTS

    if (aTheTouchedButton == TouchButtonCalibration) {
        //Calibration Button pressed -> calibrate touch panel
        TouchPanel.doCalibration(false);
        showSettings();
        return;
    }
#endif

    if (aTheTouchedButton == TouchButtonGameOfLife) {
        // Game of Life button pressed
        showGolSettings();
        mActualApplication = APPLICATION_GAME_OF_LIFE;
        return;
    }
    if (aTheTouchedButton == TouchButtonDemoSettings) {
        // Settings button pressed
        showSettings();
        return;
    }
    if (aTheTouchedButton == TouchButtonBack) {
        // Home button pressed
        showGuiDemoMenu();
        return;
    }
}
Ejemplo n.º 13
0
static void doChangeDACFrequency(TouchButton * const aTheTouchedButton, int16_t aValue) {

    uint32_t tTimerReloadValue = sTimerReloadValue + aValue;
    if (tTimerReloadValue < DAC_TIMER_MIN_RELOAD_VALUE) {
        FeedbackTone(FEEDBACK_TONE_SHORT_ERROR);
        return;
    }
    FeedbackToneOK();
    ComputeFrequencyAndSetTimer(tTimerReloadValue, true);
    int tNewSliderValue = sLastFrequencySliderValue;
    // check if slider value must be updated
    if (aValue > 0) {
        // increase period, decrease frequency
        tNewSliderValue--;
        if (ComputeReloadValue(tNewSliderValue) <= sTimerReloadValue) {
            do {
                tNewSliderValue--;
            } while (ComputeReloadValue(tNewSliderValue) <= sTimerReloadValue);
            tNewSliderValue++;
            sLastFrequencySliderValue = tNewSliderValue;
            TouchSliderHorizontal.setActualValueAndDrawBar(tNewSliderValue);
            TouchSliderHorizontal.printValue();
        }
    } else {
        tNewSliderValue++;
        if (ComputeReloadValue(tNewSliderValue) >= sTimerReloadValue) {
            do {
                tNewSliderValue++;
            } while (ComputeReloadValue(tNewSliderValue) >= sTimerReloadValue);
            tNewSliderValue--;
            sLastFrequencySliderValue = tNewSliderValue;
            TouchSliderHorizontal.setActualValueAndDrawBar(tNewSliderValue);
            TouchSliderHorizontal.printValue();
        }
    }
}
/**
 * changes the unit (mHz - MHz)
 * @param aTheTouchedButton
 * @param aValue
 */
void doChangeFrequencyFactor(TouchButton * const aTheTouchedButton, int16_t aValue) {
    FeedbackToneOK();
    setFrequencyFactor(aValue);
    ComputePeriodAndSetTimer(true);
}
Ejemplo n.º 15
0
void doGolDying(TouchButton * const aTheTouchedButton, int16_t aValue) {
    FeedbackToneOK();
    aValue = !aValue;
    syncronizeGolSliderAndButton(aValue);
}
Ejemplo n.º 16
0
/**
 *
 * @param aTheTouchedButton
 * @param aValue assume as boolean here
 */
void doToggleRedGreenButton(TouchButton * const aTheTouchedButton, int16_t aValue) {
    FeedbackToneOK();
    aValue = !aValue;
    aTheTouchedButton->setRedGreenButtonColorAndDraw(aValue);
}
void doSetFixedFrequency(TouchButton * const aTheTouchedButton, int16_t aValue) {
    FeedbackToneOK();
    sFrequency = aValue;
    ComputePeriodAndSetTimer(true);
}