test
Dependencies: ad5422_arduino mbed LT1446 ADS1248-1 LM35-1 Flash FT813 PGA280_ADS1259
Diff: TFT/display.myWidgets.cpp
- Revision:
- 5:21240fa1ee4c
- Child:
- 7:c364201bc3ed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TFT/display.myWidgets.cpp Thu Aug 13 14:37:39 2020 +0000 @@ -0,0 +1,61 @@ +#include "display.h" + +void Display::myWdget_Edit(uint16_t x,uint16_t y,uint16_t w,uint16_t h,uint8_t selected,const char * text) +{ + + (*_TFT).DL(BEGIN(RECTS)); + //рамка + (*_TFT).DL(COLOR_RGB(0, 0, 0)); + if(selected) + (*_TFT).DL(COLOR_RGB(255, 0, 0));//если выбрана для редактирования + (*_TFT).DL(VERTEX2II(x, y, 0, 0)); + (*_TFT).DL(VERTEX2II(x+w, y+h, 0, 0)); + //поле + (*_TFT).DL(COLOR_RGB(255, 255, 255)); + (*_TFT).DL(VERTEX2II(x+2, y+2, 0, 0)); + (*_TFT).DL(VERTEX2II(x+w-2, y+h-2, 0, 0)); + (*_TFT).DL(END()); + (*_TFT).DL(COLOR_RGB(0, 0, 0)); + (*_TFT).Text(x+4, y+7, 28, 0, text); +} + +void Display::myWdget_NumPad(uint16_t x,uint16_t y) +{ + char key=pressedButton; + (*_TFT).Keys(x, y, 240, 60, 29, key, "123"); + (*_TFT).Keys(x, y+63, 240, 60, 29, key, "456"); + (*_TFT).Keys(x, y+63+63, 240, 60, 29, key, "789"); + (*_TFT).Keys(x, y+63+63+63, 240, 60, 29, key, ".0<"); +} + +void Display::myWdget_Edit_change(char * text) +{ +/*cursor=strlen(text); +char i; +while(text[i]) +{ +str_edit[i]=text[i]; +i++; +} +str_edit[i]='_';*/ + +if(pressedButton>='0'&&pressedButton<='9'||pressedButton=='.'||pressedButton=='<') + { + if(cursor<10){ + if(pressedButton=='<'){ + cursor--; + str_edit[cursor]='_'; + str_edit[cursor+1]=0; + if(cursor==255) cursor=0; + } + else{ + str_edit[cursor]=pressedButton; + str_edit[cursor+1]='_'; + str_edit[cursor+2]=0; + cursor++;} + + }//cersor<10 + else cursor=9; + } +} + \ No newline at end of file