Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ad5422_arduino mbed LT1446 ADS1248-1 LM35-1 Flash FT813 PGA280_ADS1259
display.myWidgets.cpp
00001 #include "display.h" 00002 00003 void Display::myWdget_Edit(uint16_t x,uint16_t y,uint16_t w,uint16_t h,uint8_t selected,const char * text) 00004 { 00005 00006 (*_TFT).DL(BEGIN(RECTS)); 00007 //рамка 00008 (*_TFT).DL(COLOR_RGB(0, 0, 0)); 00009 if(selected) 00010 (*_TFT).DL(COLOR_RGB(255, 0, 0));//если выбрана для редактирования 00011 (*_TFT).DL(VERTEX2II(x, y, 0, 0)); 00012 (*_TFT).DL(VERTEX2II(x+w, y+h, 0, 0)); 00013 //поле 00014 (*_TFT).DL(COLOR_RGB(255, 255, 255)); 00015 (*_TFT).DL(VERTEX2II(x+2, y+2, 0, 0)); 00016 (*_TFT).DL(VERTEX2II(x+w-2, y+h-2, 0, 0)); 00017 (*_TFT).DL(END()); 00018 (*_TFT).DL(COLOR_RGB(0, 0, 0)); 00019 (*_TFT).Text(x+4, y+7, 28, 0, text); 00020 } 00021 00022 void Display::myWdget_NumPad(uint16_t x,uint16_t y) 00023 { 00024 //шарина одной кнопки = 240/3 00025 //высота 60 00026 //расстояние между 2 00027 char key; 00028 uint16_t y1=y; //для отрисовки 00029 if(TouchX>x&&TouchY>y&&TouchX<(x+80)&&TouchY<(y+60)) 00030 key='1'; 00031 pressedButton=key; 00032 if(TouchX>x+80&&TouchY>y&&TouchX<(x+160)&&TouchY<(y+60)) 00033 key='2'; 00034 pressedButton=key; 00035 if(TouchX>x+160&&TouchY>y&&TouchX<(x+240)&&TouchY<(y+60)) 00036 key='3'; 00037 pressedButton=key; 00038 00039 y+=63; 00040 if(TouchX>x&&TouchY>y&&TouchX<(x+80)&&TouchY<(y+60)) 00041 key='4'; 00042 pressedButton=key; 00043 if(TouchX>x+80&&TouchY>y&&TouchX<(x+160)&&TouchY<(y+60)) 00044 key='5'; 00045 pressedButton=key; 00046 if(TouchX>x+160&&TouchY>y&&TouchX<(x+240)&&TouchY<(y+60)) 00047 key='6'; 00048 pressedButton=key; 00049 00050 y+=63; 00051 if(TouchX>x&&TouchY>y&&TouchX<(x+80)&&TouchY<(y+60)) 00052 key='7'; 00053 pressedButton=key; 00054 if(TouchX>x+80&&TouchY>y&&TouchX<(x+160)&&TouchY<(y+60)) 00055 key='8'; 00056 pressedButton=key; 00057 if(TouchX>x+160&&TouchY>y&&TouchX<(x+240)&&TouchY<(y+60)) 00058 key='9'; 00059 pressedButton=key; 00060 00061 y+=63; 00062 if(TouchX>x&&TouchY>y&&TouchX<(x+80)&&TouchY<(y+60)) 00063 key='.'; 00064 pressedButton=key; 00065 if(TouchX>x+80&&TouchY>y&&TouchX<(x+160)&&TouchY<(y+60)) 00066 key='0'; 00067 pressedButton=key; 00068 if(TouchX>x+160&&TouchY>y&&TouchX<(x+240)&&TouchY<(y+60)) 00069 key='<'; 00070 pressedButton=key; 00071 00072 (*_TFT).Keys(x, y1, 240, 60, 29, key, "123"); 00073 (*_TFT).Keys(x, y1+63, 240, 60, 29, key, "456"); 00074 (*_TFT).Keys(x, y1+63+63, 240, 60, 29, key, "789"); 00075 (*_TFT).Keys(x, y1+63+63+63, 240, 60, 29, key, ".0<"); 00076 } 00077 00078 void Display::myWdget_Edit_change(char * text) 00079 { 00080 /*cursor=strlen(text); 00081 char i; 00082 while(text[i]) 00083 { 00084 str_edit[i]=text[i]; 00085 i++; 00086 } 00087 str_edit[i]='_';*/ 00088 00089 if(pressedButton>='0'&&pressedButton<='9'||pressedButton=='.'||pressedButton=='<') 00090 { 00091 if(cursor<10){ 00092 if(pressedButton=='<'){ 00093 cursor--; 00094 str_edit[cursor]='_'; 00095 str_edit[cursor+1]=0; 00096 if(cursor==255) cursor=0; 00097 } 00098 else{ 00099 str_edit[cursor]=pressedButton; 00100 str_edit[cursor+1]='_'; 00101 str_edit[cursor+2]=0; 00102 cursor++;} 00103 00104 }//cersor<10 00105 else cursor=9; 00106 } 00107 } 00108
Generated on Thu Jul 14 2022 17:32:52 by
1.7.2