コード例 #1
0
ファイル: prosac.c プロジェクト: gciotto/workspace
void refreshConnectState(TS_StateTypeDef ts_event) {

    uint32_t color_back_pushed, color_back_normal;

    if (!isConnected) {
        memcpy(buttons[BUTTON_CONNECT].title, "Conn.\0", 6);
        color_back_pushed = LCD_COLOR_DARKGREEN;
        color_back_normal = LCD_COLOR_LIGHTGREEN;
    }
    else {
        memcpy(buttons[BUTTON_CONNECT].title, "Disc.\0", 6);
        color_back_pushed = LCD_COLOR_DARKRED;
        color_back_normal = LCD_COLOR_LIGHTRED;
    }

    if (isTouched(ts_event, &buttons[BUTTON_CONNECT], BUTTON_WIDTH, BUTTON_HEIGTH)) {

        if (!buttons[BUTTON_CONNECT].hasBeenAcknowledged)
            buttons[BUTTON_CONNECT].buttonEventHandler((void*) &buttons[BUTTON_CONNECT]);

        if (!buttons[BUTTON_CONNECT].isPushed)
            placeButton(buttons[BUTTON_CONNECT], color_back_pushed, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
        buttons[BUTTON_CONNECT].isPushed = 1;
    }
    else {

        if (buttons[BUTTON_CONNECT].isPushed)
            placeButton(buttons[BUTTON_CONNECT], color_back_normal, LCD_COLOR_BLACK, BUTTON_WIDTH, BUTTON_HEIGTH);

        buttons[BUTTON_CONNECT].isPushed = 0;
        buttons[BUTTON_CONNECT].hasBeenAcknowledged = 0;
    }
}
コード例 #2
0
Button::Button(Qt::Orientation orientation, InsertRemove::Type type, PolicyFlags policy /*= 0*/, QWidget* parent /*= 0*/) :
    QPushButton(parent),
    _type(type),
    _orientation(orientation),
    _point(QPoint(0,0)),
    _policy(policy)
{
    QString plus_css =
            "*         {image: url(':/plus-icon.png'); border: 0;}"
            "*:hover   {image: url(':/plus-icon-hover.png');}"
            "*:pressed {image: url(':/plus-icon-pressed.png');} ";

    QString minus_css =
            "*         {image: url(':/minus-icon.png'); border: 0;}"
            "*:hover   {image: url(':/minus-icon-hover.png');}"
            "*:pressed {image: url(':/minus-icon-pressed.png');} ";

    if (_type == Insert)
        setStyleSheet(plus_css);
    else
        setStyleSheet(minus_css);

    setFixedSize(SIZE_PX,SIZE_PX);
    placeButton();
    connect(this,SIGNAL(clicked()),this,SLOT(on_clicked()));
}
コード例 #3
0
void Button::setPolicy(PolicyFlags policy)
{
    if ( _policy != policy)
    {
        _policy = policy;
        placeButton();
    }
}
コード例 #4
0
void Button::setPoint(const QPoint& point)
{
    if (_point != point)
    {
        _point = point;
        placeButton();
    }
}
コード例 #5
0
ファイル: prosac.c プロジェクト: gciotto/workspace
void repaintButtons() {

    placeButton(buttons[BUTTON_E0], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_E1], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_01], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_05], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_C8], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_C9], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_CB], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_CC], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
}
コード例 #6
0
ファイル: prosac.c プロジェクト: gciotto/workspace
void setConnectedState(uint8_t isConnected) {

    buttons[BUTTON_E0].isEnabled = isConnected;
    buttons[BUTTON_E1].isEnabled = isConnected;
    buttons[BUTTON_01].isEnabled = isConnected;
    buttons[BUTTON_05].isEnabled = isConnected;
    buttons[BUTTON_C8].isEnabled = isConnected;
    buttons[BUTTON_C9].isEnabled = isConnected;
    buttons[BUTTON_CB].isEnabled = isConnected;
    buttons[BUTTON_CC].isEnabled = isConnected;

    placeButton(buttons[BUTTON_E0], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_E1], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_01], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_05], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_C8], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_C9], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_CB], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_CC], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);

}
コード例 #7
0
ファイル: prosac.c プロジェクト: gciotto/workspace
void drawHomeScreen() {

    setTitle("Cliente PROSAC");

    setStatus(isConnected);

    uint32_t color_connect;
    if (isConnected)
        color_connect = LCD_COLOR_LIGHTRED;
    else color_connect = LCD_COLOR_LIGHTGREEN;

    placeButton(buttons[BUTTON_CONNECT], color_connect, LCD_COLOR_BLACK, BUTTON_WIDTH, BUTTON_HEIGTH);

    placeBoard(&pboards[0], pboards[0].board.module.background_color, LCD_COLOR_BLACK);
    placeBoard(&pboards[1], pboards[1].board.module.background_color, LCD_COLOR_BLACK);
    placeBoard(&pboards[2], pboards[2].board.module.background_color, LCD_COLOR_BLACK);
    placeBoard(&pboards[3], pboards[3].board.module.background_color, LCD_COLOR_BLACK);

}
コード例 #8
0
ファイル: prosac.c プロジェクト: gciotto/workspace
void unpaintPushedButton (button_t button, uint16_t width, uint16_t heigth) {
    placeButton(button, LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, width, heigth);
}
コード例 #9
0
ファイル: prosac.c プロジェクト: gciotto/workspace
void paintPushedButton (button_t button, uint16_t width, uint16_t heigth) {
    placeButton(button, LCD_COLOR_LIGHTBLUE, LCD_COLOR_BLACK, width, heigth);
}
コード例 #10
0
ファイル: prosac.c プロジェクト: gciotto/workspace
void drawLOCON(void* board) {

    pboard_t *aBoard = (pboard_t*) board;

    xSemaphoreTake(mutex_drawer, portMAX_DELAY);

    BSP_LCD_Clear(LCD_COLOR_WHITE);

    BSP_LCD_SetBackColor(LCD_COLOR_WHITE);

    BSP_LCD_SetFont(&Font24);

    BSP_LCD_SetTextColor(LCD_COLOR_BLUE);

    char buffer[3];
    memset(buffer, 0, 3);
    sprintf (buffer,"%d", aBoard->board.id);

    BSP_LCD_DisplayStringAt(30, 45, (uint8_t*) buffer, LEFT_MODE);

    BSP_LCD_SetTextColor(aBoard->board.module.background_color);
    BSP_LCD_DisplayStringAt(55, 45, (uint8_t*) aBoard->board.module.name, LEFT_MODE);

    BSP_LCD_SetFont(&Font20);

    BSP_LCD_SetTextColor(LCD_COLOR_RED);

    BSP_LCD_DisplayStringAt(250, 30, (uint8_t*) "SAIDAS ", LEFT_MODE);

    BSP_LCD_SetTextColor(LCD_COLOR_BLACK);

    BSP_LCD_DisplayStringAt(250, 60, (uint8_t*) "Analog. : ", LEFT_MODE);
    BSP_LCD_DisplayStringAt(250, 90, (uint8_t*) "Digital : ", LEFT_MODE);

    BSP_LCD_SetTextColor(LCD_COLOR_BLUE);

    BSP_LCD_DisplayStringAt(250, 120, (uint8_t*) "ENTRADAS ", LEFT_MODE);

    BSP_LCD_SetTextColor(LCD_COLOR_BLACK);

    BSP_LCD_DisplayStringAt(250, 150, (uint8_t*) "An : 2000 ", LEFT_MODE);
    BSP_LCD_DisplayStringAt(250, 180, (uint8_t*) "D  : 56 ", LEFT_MODE);

    xSemaphoreGive(mutex_drawer);

    buttons_ramp_cycle[4].isEnabled = 1;
    buttons_ramp_cycle[5].isEnabled = 1;
    placeButton(buttons_ramp_cycle[4], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_INCREASE_W,BUTTON_INCREASE_H);
    placeButton(buttons_ramp_cycle[5], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_INCREASE_W,BUTTON_INCREASE_H);

    buttons_ramp_cycle[6].isEnabled = 1;
    buttons_ramp_cycle[7].isEnabled = 1;
    placeButton(buttons_ramp_cycle[6], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_INCREASE_W,BUTTON_INCREASE_H);
    placeButton(buttons_ramp_cycle[7], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_INCREASE_W,BUTTON_INCREASE_H);

    digitalIn = 56;
    analogIn  = 2000;

    xSemaphoreTake(mutex_drawer, portMAX_DELAY);

    BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
    BSP_LCD_SetTextColor(LCD_COLOR_GREEN);

    rampSelected = 128;
    BSP_LCD_DisplayStringAt(250, 210, (uint8_t*) "RAMPA   : ", LEFT_MODE);

    BSP_LCD_SetTextColor(LCD_COLOR_RED);
    BSP_LCD_DisplayStringAt(380, 210, (uint8_t*) "N ", LEFT_MODE);

    xSemaphoreGive(mutex_drawer);

    buttons_ramp_cycle[0].isEnabled = 0;
    buttons_ramp_cycle[1].isEnabled = 1;
    placeButton(buttons_ramp_cycle[0], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_INCREASE_W,BUTTON_INCREASE_H);
    placeButton(buttons_ramp_cycle[1], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_INCREASE_W,BUTTON_INCREASE_H);

    xSemaphoreTake(mutex_drawer, portMAX_DELAY);
    BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
    BSP_LCD_SetTextColor(LCD_COLOR_ORANGE);

    BSP_LCD_DisplayStringAt(250, 240, (uint8_t*) "CICLAGEM: ", LEFT_MODE);

    cycleSelected = 128;
    BSP_LCD_SetTextColor(LCD_COLOR_RED);
    BSP_LCD_DisplayStringAt(380, 240, (uint8_t*) "N ", LEFT_MODE);

    xSemaphoreGive(mutex_drawer);

    buttons_ramp_cycle[2].isEnabled = 0;
    buttons_ramp_cycle[3].isEnabled = 2;
    placeButton(buttons_ramp_cycle[2], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_INCREASE_W,BUTTON_INCREASE_H);
    placeButton(buttons_ramp_cycle[3], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_INCREASE_W,BUTTON_INCREASE_H);

    buttons[BUTTON_E0].isEnabled = 1;
    buttons[BUTTON_01].isEnabled = 1;
    buttons[BUTTON_05].isEnabled = 1;
    buttons[BUTTON_C8].isEnabled = 1;

    placeButton(buttons[BUTTON_E0], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_E1], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_01], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_05], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_C8], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_C9], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_CB], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);
    placeButton(buttons[BUTTON_CC], LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);

    placeButton(button_home, LCD_COLOR_DARKBLUE, LCD_COLOR_WHITE, BUTTON_WIDTH, BUTTON_HEIGTH);

}