test

Dependencies:   ad5422_arduino mbed LT1446 ADS1248-1 LM35-1 Flash FT813 PGA280_ADS1259

Committer:
nikmaos
Date:
Tue Sep 01 10:52:34 2020 +0000
Revision:
7:c364201bc3ed
Parent:
5:21240fa1ee4c
1.09.2020;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nikmaos 5:21240fa1ee4c 1 #include "display.h"
nikmaos 5:21240fa1ee4c 2
nikmaos 5:21240fa1ee4c 3 void Display::myWdget_Edit(uint16_t x,uint16_t y,uint16_t w,uint16_t h,uint8_t selected,const char * text)
nikmaos 5:21240fa1ee4c 4 {
nikmaos 5:21240fa1ee4c 5
nikmaos 5:21240fa1ee4c 6 (*_TFT).DL(BEGIN(RECTS));
nikmaos 5:21240fa1ee4c 7 //рамка
nikmaos 5:21240fa1ee4c 8 (*_TFT).DL(COLOR_RGB(0, 0, 0));
nikmaos 5:21240fa1ee4c 9 if(selected)
nikmaos 5:21240fa1ee4c 10 (*_TFT).DL(COLOR_RGB(255, 0, 0));//если выбрана для редактирования
nikmaos 5:21240fa1ee4c 11 (*_TFT).DL(VERTEX2II(x, y, 0, 0));
nikmaos 5:21240fa1ee4c 12 (*_TFT).DL(VERTEX2II(x+w, y+h, 0, 0));
nikmaos 5:21240fa1ee4c 13 //поле
nikmaos 5:21240fa1ee4c 14 (*_TFT).DL(COLOR_RGB(255, 255, 255));
nikmaos 5:21240fa1ee4c 15 (*_TFT).DL(VERTEX2II(x+2, y+2, 0, 0));
nikmaos 5:21240fa1ee4c 16 (*_TFT).DL(VERTEX2II(x+w-2, y+h-2, 0, 0));
nikmaos 5:21240fa1ee4c 17 (*_TFT).DL(END());
nikmaos 5:21240fa1ee4c 18 (*_TFT).DL(COLOR_RGB(0, 0, 0));
nikmaos 5:21240fa1ee4c 19 (*_TFT).Text(x+4, y+7, 28, 0, text);
nikmaos 5:21240fa1ee4c 20 }
nikmaos 5:21240fa1ee4c 21
nikmaos 5:21240fa1ee4c 22 void Display::myWdget_NumPad(uint16_t x,uint16_t y)
nikmaos 5:21240fa1ee4c 23 {
nikmaos 7:c364201bc3ed 24 //шарина одной кнопки = 240/3
nikmaos 7:c364201bc3ed 25 //высота 60
nikmaos 7:c364201bc3ed 26 //расстояние между 2
nikmaos 7:c364201bc3ed 27 char key;
nikmaos 7:c364201bc3ed 28 uint16_t y1=y; //для отрисовки
nikmaos 7:c364201bc3ed 29 if(TouchX>x&&TouchY>y&&TouchX<(x+80)&&TouchY<(y+60))
nikmaos 7:c364201bc3ed 30 key='1';
nikmaos 7:c364201bc3ed 31 pressedButton=key;
nikmaos 7:c364201bc3ed 32 if(TouchX>x+80&&TouchY>y&&TouchX<(x+160)&&TouchY<(y+60))
nikmaos 7:c364201bc3ed 33 key='2';
nikmaos 7:c364201bc3ed 34 pressedButton=key;
nikmaos 7:c364201bc3ed 35 if(TouchX>x+160&&TouchY>y&&TouchX<(x+240)&&TouchY<(y+60))
nikmaos 7:c364201bc3ed 36 key='3';
nikmaos 7:c364201bc3ed 37 pressedButton=key;
nikmaos 7:c364201bc3ed 38
nikmaos 7:c364201bc3ed 39 y+=63;
nikmaos 7:c364201bc3ed 40 if(TouchX>x&&TouchY>y&&TouchX<(x+80)&&TouchY<(y+60))
nikmaos 7:c364201bc3ed 41 key='4';
nikmaos 7:c364201bc3ed 42 pressedButton=key;
nikmaos 7:c364201bc3ed 43 if(TouchX>x+80&&TouchY>y&&TouchX<(x+160)&&TouchY<(y+60))
nikmaos 7:c364201bc3ed 44 key='5';
nikmaos 7:c364201bc3ed 45 pressedButton=key;
nikmaos 7:c364201bc3ed 46 if(TouchX>x+160&&TouchY>y&&TouchX<(x+240)&&TouchY<(y+60))
nikmaos 7:c364201bc3ed 47 key='6';
nikmaos 7:c364201bc3ed 48 pressedButton=key;
nikmaos 7:c364201bc3ed 49
nikmaos 7:c364201bc3ed 50 y+=63;
nikmaos 7:c364201bc3ed 51 if(TouchX>x&&TouchY>y&&TouchX<(x+80)&&TouchY<(y+60))
nikmaos 7:c364201bc3ed 52 key='7';
nikmaos 7:c364201bc3ed 53 pressedButton=key;
nikmaos 7:c364201bc3ed 54 if(TouchX>x+80&&TouchY>y&&TouchX<(x+160)&&TouchY<(y+60))
nikmaos 7:c364201bc3ed 55 key='8';
nikmaos 7:c364201bc3ed 56 pressedButton=key;
nikmaos 7:c364201bc3ed 57 if(TouchX>x+160&&TouchY>y&&TouchX<(x+240)&&TouchY<(y+60))
nikmaos 7:c364201bc3ed 58 key='9';
nikmaos 7:c364201bc3ed 59 pressedButton=key;
nikmaos 7:c364201bc3ed 60
nikmaos 7:c364201bc3ed 61 y+=63;
nikmaos 7:c364201bc3ed 62 if(TouchX>x&&TouchY>y&&TouchX<(x+80)&&TouchY<(y+60))
nikmaos 7:c364201bc3ed 63 key='.';
nikmaos 7:c364201bc3ed 64 pressedButton=key;
nikmaos 7:c364201bc3ed 65 if(TouchX>x+80&&TouchY>y&&TouchX<(x+160)&&TouchY<(y+60))
nikmaos 7:c364201bc3ed 66 key='0';
nikmaos 7:c364201bc3ed 67 pressedButton=key;
nikmaos 7:c364201bc3ed 68 if(TouchX>x+160&&TouchY>y&&TouchX<(x+240)&&TouchY<(y+60))
nikmaos 7:c364201bc3ed 69 key='<';
nikmaos 7:c364201bc3ed 70 pressedButton=key;
nikmaos 7:c364201bc3ed 71
nikmaos 7:c364201bc3ed 72 (*_TFT).Keys(x, y1, 240, 60, 29, key, "123");
nikmaos 7:c364201bc3ed 73 (*_TFT).Keys(x, y1+63, 240, 60, 29, key, "456");
nikmaos 7:c364201bc3ed 74 (*_TFT).Keys(x, y1+63+63, 240, 60, 29, key, "789");
nikmaos 7:c364201bc3ed 75 (*_TFT).Keys(x, y1+63+63+63, 240, 60, 29, key, ".0<");
nikmaos 5:21240fa1ee4c 76 }
nikmaos 5:21240fa1ee4c 77
nikmaos 5:21240fa1ee4c 78 void Display::myWdget_Edit_change(char * text)
nikmaos 5:21240fa1ee4c 79 {
nikmaos 5:21240fa1ee4c 80 /*cursor=strlen(text);
nikmaos 5:21240fa1ee4c 81 char i;
nikmaos 5:21240fa1ee4c 82 while(text[i])
nikmaos 5:21240fa1ee4c 83 {
nikmaos 5:21240fa1ee4c 84 str_edit[i]=text[i];
nikmaos 5:21240fa1ee4c 85 i++;
nikmaos 5:21240fa1ee4c 86 }
nikmaos 5:21240fa1ee4c 87 str_edit[i]='_';*/
nikmaos 5:21240fa1ee4c 88
nikmaos 5:21240fa1ee4c 89 if(pressedButton>='0'&&pressedButton<='9'||pressedButton=='.'||pressedButton=='<')
nikmaos 5:21240fa1ee4c 90 {
nikmaos 5:21240fa1ee4c 91 if(cursor<10){
nikmaos 5:21240fa1ee4c 92 if(pressedButton=='<'){
nikmaos 5:21240fa1ee4c 93 cursor--;
nikmaos 5:21240fa1ee4c 94 str_edit[cursor]='_';
nikmaos 5:21240fa1ee4c 95 str_edit[cursor+1]=0;
nikmaos 5:21240fa1ee4c 96 if(cursor==255) cursor=0;
nikmaos 5:21240fa1ee4c 97 }
nikmaos 5:21240fa1ee4c 98 else{
nikmaos 5:21240fa1ee4c 99 str_edit[cursor]=pressedButton;
nikmaos 5:21240fa1ee4c 100 str_edit[cursor+1]='_';
nikmaos 5:21240fa1ee4c 101 str_edit[cursor+2]=0;
nikmaos 5:21240fa1ee4c 102 cursor++;}
nikmaos 5:21240fa1ee4c 103
nikmaos 5:21240fa1ee4c 104 }//cersor<10
nikmaos 5:21240fa1ee4c 105 else cursor=9;
nikmaos 5:21240fa1ee4c 106 }
nikmaos 5:21240fa1ee4c 107 }
nikmaos 5:21240fa1ee4c 108