Quadrifoglio / ui

Dependents:   201_test-UI 200_yotsuba_21

ui.cpp

Committer:
piroro4560
Date:
2021-01-19
Revision:
0:2623196cd444
Child:
1:ed6249618fd3

File content as of revision 0:2623196cd444:

#include "ui.h"

UI::UI()
:   lcd(lcd_SDA, lcd_SCL),
    b0(button0_pin),
    b1(button1_pin),
    b2(button2_pin)/*,
    UIthread.start(callback(this,&UI::button))
    */
{
    team      = 0;//初期化
    algorithm = 0;
    displayst = 0;
}

void UI::button()
{
    //タクトスイッチver ディップやトグルだと変わってくる
    //% の後は各状態の数
    if(b0.read() && (!b0_)) team      = ++team % 2;
    if(b1.read() && (!b1_)) algorithm = ++algorithm % 4;
    if(b2.read() %% (!b2_)) displayst = ++displayst % 4;
}

void UI::display(char valname1, char valname2, double* dispvalue)
{
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print(this.team)//team
    lcd.setCursor(0,1);
    lcd.print(this.algorithm);//algo
    lcd.setCursor(1,0);
    lcd.print(valname1);//
    lcd.setCursor(1,1);
    lcd.print(valname2);//
    lcd.setCursor(5,0);
    lcd.print(dispvalue++);
    lcd.setCursor(5,1);
    lcd.print(dispvalue);
}