| Linduino 1.3.0 Linear Technology Arduino-Compatible Demonstration Board

EasySMU_IOpanel.cpp
Go to the documentation of this file.
1 /*!
2 EasySMU_IOpanel Library to Enable Touchscreen Control of EasySMU
3
4 [User Guide](http://www.linear.com/docs/58670 "EasySMU User Guide") \n
5 [Schematic](http://www.linear.com/docs/58671 "Schematic") \n
6 [Top-Level Linduino Firmware for EasySMU](file:EasySMU__Run_8ino.html "Top-Level Linduino Firmware for EasySMU") \n
7 [EasySMU Class Reference](file:classEasySMU.html "EasySMU Class Reference") \n
8 [EasySMU_IOpanel Class Reference](file:classEasySMU__IOpanel.html "EasySMU_IOpanel Class Reference") \n
9 [EasySMU Webpage](http://www.linear.com/solutions/7943 "EasySMU Webpage") \n
10
11 @verbatim
12
13 EasySMU: I2C Address Translator Demonstration and a Simple Multi-Channel Source Measurement Unit
14
15 LTC4316: Single I2C/SMBus Address Translator
16 LT1970A: Power Op Amp with Adjustable Precision Current Limit
17 LT5400: Quad Matched Resistor Network
18 LTC2655: Quad I2C 16-/12-Bit Rail-to-Rail DACs with 10ppm/°C Max Reference
19 LTC3265: Low Noise Dual Supply with Boost and Inverting Charge Pumps
20 LTC2051: Dual Zero-Drift Operational Amplifier
21 LT3010: 50mA, 3V to 80V Low Dropout Micropower Linear Regulator
22 LT1991: Precision, 100µA Gain Selectable Amplifier
23 LTC6655: 0.25ppm Noise, Low Drift Precision Reference
24 LTC2485: 24-Bit ΔΣ ADC with Easy Drive Input Current Cancellation and I2C Interface
25
26 EasySMU is a single-channel ±12V/40mA programmable-voltage/programmable-current
27 source with accurate voltage/current measurement capability. The LTC4316 I2C
28 Address Translator enables up to eight independent EasySMUs to be controlled
29 by a single I2C master.
30
31 In this demonstration, each EasySMU board contains four I2C slaves and the
32 associated components to implement a single-channel ±12V/40mA programmable-
33 voltage/programmable-current source. The LTC4316 translates the I2C addresses
34 of each EasySMU to a unique set of addresses, enabling up to eight EasySMU
35 boards to be stacked on a single Linduino (I2C master). In this form, it
36 resembles a multi-channel automated test system. Alternatively, an optional
37 touchscreen allows the user to interactively control up to four channels,
38 forming a compact multi-channel programmable-voltage/programmable-current
39 bench source for lab testing, powered from a single 12V AC wall adapter.
40
41 The primary purpose of the EasySMU is to demonstrate the LTC4316 I2C Address
42 Translator. The programmable-voltage/programmable-current source and meter
43 also provide a convenient demonstration of the associated components: LT1970A,
44 LT5400-3, LTC2655-H, LTC3265, LTC2051, LT3010, LT1991, LTC6655, and LTC2485.
45 While the EasySMU is not designed to demonstrate the ultimate performance that
46 can be obtained from each of those components, the EasySMU does provide
47 impressive results from a reasonably simple circuit.
48
49 @endverbatim
50
51
52 Copyright 2018(c) Analog Devices, Inc.
53
54 All rights reserved.
55
56 Redistribution and use in source and binary forms, with or without
57 modification, are permitted provided that the following conditions are met:
58 - Redistributions of source code must retain the above copyright
59 notice, this list of conditions and the following disclaimer.
60 - Redistributions in binary form must reproduce the above copyright
61 notice, this list of conditions and the following disclaimer in
62 the documentation and/or other materials provided with the
63 distribution.
64 - Neither the name of Analog Devices, Inc. nor the names of its
65 contributors may be used to endorse or promote products derived
66 from this software without specific prior written permission.
67 - The use of this software may or may not infringe the patent rights
68 of one or more patent holders. This license does not release you
69 from the requirement that you obtain separate licenses from these
70 patent holders to use this software.
71 - Use of the software either in source or binary form, must be run
72 on or directly connected to an Analog Devices Inc. component.
73
74 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
75 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
76 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
77 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
78 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
79 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
80 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
81 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
82 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
83 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
84 */
85
86 /*! @file
87 @ingroup EasySMU
88 EasySMU_IOpanel Library to Enable Touchscreen Control of EasySMU
89 */
90
91 #include <Adafruit_ILI9341.h>
92 #include <Adafruit_GFX.h>
93 #include "EasySMU_IOpanel.h"
94 #include <Anonymous_Pro6pt7b.h>
95 #include <Anonymous_ProBold14pt7b.h>
96
97 #ifdef ADAFRUIT_TFT_TOUCHSHIELD_1947
98 #include <Adafruit_FT6206.h>
99 #endif
100
101 //#include guard not implemented properly in SeeedTouchScreen.h so it was not included here.
102 //#ifdef SEEEDSTUDIO_TFT_TOUCHSHIELD_V2
103 //#include <SeeedTouchScreen.h>
104 //#endif
105
106 void EasySMU_IOpanel::Init()
107 {
108 SMUselected_=_SMU0;
109 button_pressed_=_NONE;
110 //init Display
111 lcd.begin();
112 lcd.setRotation(1);
113
114 //init Touch-Controller
115 #ifdef ADAFRUIT_TFT_TOUCHSHIELD_1947
116 if (! touchp.begin(40)) // pass in 'sensitivity' coefficient
117 {
118 enabled_ = 0;
119 Serial.println("No touchscreen present.");
120 return;
121 }
122
123 #endif // ADAFRUIT_TFT_TOUCHSHIELD_1947
124
125 enabled_ = 1;
126
127 lcd.fillScreen(ILI9341_WHITE);
128
129 int16_t lcdWidth, lcdHeight;
130
131 lcdWidth=lcd.width();
132
133 lcdHeight=lcd.height();
134
135 lcd.fillRoundRect(_SMU0_LEFT, _SMU0_TOP, _SMU_WIDTH, _SMU_HEIGHT, _BUTTON_RADIUS , ILI9341_BLUE);
136 lcd.fillRoundRect(_SMU1_LEFT, _SMU1_TOP, _SMU_WIDTH, _SMU_HEIGHT, _BUTTON_RADIUS , ILI9341_BLUE);
137 lcd.fillRoundRect(_SMU2_LEFT, _SMU2_TOP, _SMU_WIDTH, _SMU_HEIGHT, _BUTTON_RADIUS , ILI9341_BLUE);
138 lcd.fillRoundRect(_SMU3_LEFT, _SMU3_TOP, _SMU_WIDTH, _SMU_HEIGHT, _BUTTON_RADIUS , ILI9341_BLUE);
139 lcd.setTextColor(ILI9341_WHITE,ILI9341_BLUE);
140 lcd.setFont(&Anonymous_Pro6pt7b);
141
142 DisplaySMULabel();
143
144 lcd.fillRoundRect(_VPLUS_LEFT, _VPLUS_TOP, _BUTTON_WIDTH, _BUTTON_HEIGHT, _BUTTON_RADIUS , ILI9341_BLUE);
145 lcd.fillRoundRect(_VMINUS_LEFT, _VMINUS_TOP, _BUTTON_WIDTH, _BUTTON_HEIGHT, _BUTTON_RADIUS , ILI9341_BLUE);
146 lcd.fillRoundRect(_IPLUS_LEFT, _IPLUS_TOP, _BUTTON_WIDTH, _BUTTON_HEIGHT, _BUTTON_RADIUS , ILI9341_BLUE);
147 lcd.fillRoundRect(_IMINUS_LEFT, _IMINUS_TOP, _BUTTON_WIDTH, _BUTTON_HEIGHT, _BUTTON_RADIUS , ILI9341_BLUE);
148 lcd.fillRoundRect(_VPLUSPLUS_LEFT, _VPLUSPLUS_TOP, _BUTTON_WIDTH, _BUTTON_HEIGHT, _BUTTON_RADIUS , ILI9341_BLUE);
149 lcd.fillRoundRect(_VMINUSMINUS_LEFT, _VMINUSMINUS_TOP, _BUTTON_WIDTH, _BUTTON_HEIGHT, _BUTTON_RADIUS , ILI9341_BLUE);
150 lcd.fillRoundRect(_IPLUSPLUS_LEFT, _IPLUSPLUS_TOP, _BUTTON_WIDTH, _BUTTON_HEIGHT, _BUTTON_RADIUS , ILI9341_BLUE);
151 lcd.fillRoundRect(_IMINUSMINUS_LEFT, _IMINUSMINUS_TOP, _BUTTON_WIDTH, _BUTTON_HEIGHT, _BUTTON_RADIUS , ILI9341_BLUE);
152
153 lcd.setTextColor(ILI9341_WHITE,ILI9341_BLUE);
154 lcd.setFont(&Anonymous_Pro_B14pt7b);
155
156 lcd.setCursor(_VPLUS_LEFT+_BUTTON_TEXT_LEFT, _VPLUS_TOP+_BUTTON_TEXT_TOP);
157 lcd.print("V+");
158 lcd.setCursor(_VMINUS_LEFT+_BUTTON_TEXT_LEFT, _VMINUS_TOP+_BUTTON_TEXT_TOP);
159 lcd.print("V-");
160 lcd.setCursor(_IPLUS_LEFT+_BUTTON_TEXT_LEFT, _IPLUS_TOP+_BUTTON_TEXT_TOP);
161 lcd.print("I+");
162 lcd.setCursor(_IMINUS_LEFT+_BUTTON_TEXT_LEFT, _IMINUS_TOP+_BUTTON_TEXT_TOP);
163 lcd.print("I-");
164 lcd.setCursor(_VPLUSPLUS_LEFT+_BUTTON_TEXT_PLUSPLUS_LEFT, _VPLUSPLUS_TOP+_BUTTON_TEXT_TOP);
165 lcd.print("V++");
166 lcd.setCursor(_VMINUSMINUS_LEFT+_BUTTON_TEXT_PLUSPLUS_LEFT, _VMINUSMINUS_TOP+_BUTTON_TEXT_TOP);
167 lcd.print("V--");
168 lcd.setCursor(_IPLUSPLUS_LEFT+_BUTTON_TEXT_PLUSPLUS_LEFT, _IPLUSPLUS_TOP+_BUTTON_TEXT_TOP);
169 lcd.print("I++");
170 lcd.setCursor(_IMINUSMINUS_LEFT+_BUTTON_TEXT_PLUSPLUS_LEFT, _IMINUSMINUS_TOP+_BUTTON_TEXT_TOP);
171 lcd.print("I--");
172
173 lcd.setFont(&Anonymous_Pro6pt7b);
174
175 }
176
177 int16_t EasySMU_IOpanel::CheckButton()
178 {
179 int16_t x, y;
180
181 int16_t previous_button_pressed=button_pressed_;
182 button_pressed_=_NONE;
183 if (enabled_==0)
184 {
185 return (button_pressed_);
186 }
187 #ifdef ADAFRUIT_TFT_TOUCHSHIELD_1947
188 if (touchp.touched())
189 #endif // ADAFRUIT_TFT_TOUCHSHIELD_1947
190
191 #ifdef SEEEDSTUDIO_TFT_TOUCHSHIELD_V2
192 if (touchp.isTouching())
193 #endif // SEEEDSTUDIO_TFT_TOUCHSHIELD_V2
194 {
195 #ifdef ADAFRUIT_TFT_TOUCHSHIELD_1947
196 TS_Point p = touchp.getPoint();
197 y = map(p.x, 0, 240, 0, 240);
198 x = map(p.y, 0, 320, 320, 0);
199 #endif // ADAFRUIT_TFT_TOUCHSHIELD_1947
200
201 #ifdef SEEEDSTUDIO_TFT_TOUCHSHIELD_V2
202 Point p = touchp.getPoint();
203 y = map(p.x, 1700, 300, 0, 240);
204 x = map(p.y, 1800, 200, 320, 0);
205 #endif // SEEEDSTUDIO_TFT_TOUCHSHIELD_V2
206
207
208 /* Serial.print("pX:");
209 Serial.print(p.x);
210 Serial.print(" pY:");
211 Serial.print(p.y);
212 Serial.print(" pZ:");
213 Serial.println(p.z);
214 Serial.print("X:");
215 Serial.print(x);
216 Serial.print(" Y:");
217 Serial.println(y);*/
218
219 if ((x >= _SMU0_LEFT) && (x <= _SMU0_RIGHT) && (y >= _SMU0_TOP) && (y <= _SMU0_BOTTOM))
220 {
221 button_pressed_ =_SMU0;
222 }
223 else if ((x >= _SMU1_LEFT) && (x <= _SMU1_RIGHT) && (y >= _SMU1_TOP) && (y <= _SMU1_BOTTOM))
224 {
225 button_pressed_ =_SMU1;
226 }
227 else if ((x >= _SMU2_LEFT) && (x <= _SMU2_RIGHT) && (y >= _SMU2_TOP) && (y <= _SMU2_BOTTOM))
228 {
229 button_pressed_ = _SMU2;
230 }
231 else if ((x >= _SMU3_LEFT) && (x <= _SMU3_RIGHT) && (y >= _SMU3_TOP) && (y <= _SMU3_BOTTOM))
232 {
233 button_pressed_ =_SMU3;
234 }
235 else if ((x >= _VPLUS_LEFT) && (x <= _VPLUS_RIGHT) && (y >= _VPLUS_TOP) && (y <= _VPLUS_BOTTOM))
236 {
237 button_pressed_ =_VPLUS;
238 }
239 else if ((x >= _VMINUS_LEFT) && (x <= _VMINUS_RIGHT) && (y >= _VMINUS_TOP) && (y <= _VMINUS_BOTTOM))
240 {
241 button_pressed_ =_VMINUS;
242 }
243 else if ((x >= _IPLUS_LEFT) && (x <= _IPLUS_RIGHT) && (y >= _IPLUS_TOP) && (y <= _IPLUS_BOTTOM))
244 {
245 button_pressed_ =_IPLUS;
246 }
247 else if ((x >= _IMINUS_LEFT) && (x <= _IMINUS_RIGHT) && (y >= _IMINUS_TOP) && (y <= _IMINUS_BOTTOM))
248 {
249 button_pressed_ =_IMINUS;
250 }
251 else if ((x >= _VPLUSPLUS_LEFT) && (x <= _VPLUSPLUS_RIGHT) && (y >= _VPLUSPLUS_TOP) && (y <= _VPLUSPLUS_BOTTOM))
252 {
253 button_pressed_ =_VPLUSPLUS;
254 }
255 else if ((x >= _VMINUSMINUS_LEFT) && (x <= _VMINUSMINUS_RIGHT) && (y >= _VMINUSMINUS_TOP) && (y <= _VMINUSMINUS_BOTTOM))
256 {
257 button_pressed_ =_VMINUSMINUS;
258 }
259 else if ((x >= _IPLUSPLUS_LEFT) && (x <= _IPLUSPLUS_RIGHT) && (y >= _IPLUSPLUS_TOP) && (y <= _IPLUSPLUS_BOTTOM))
260 {
261 button_pressed_ =_IPLUSPLUS;
262 }
263 else if ((x >= _IMINUSMINUS_LEFT) && (x <= _IMINUSMINUS_RIGHT) && (y >= _IMINUSMINUS_TOP) && (y <= _IMINUSMINUS_BOTTOM))
264 {
265 button_pressed_ =_IMINUSMINUS;
266 }
267
268 }
269
270 if (button_pressed_!=previous_button_pressed) start_button_pressed_=millis();
271 duration_button_pressed_=millis()-start_button_pressed_;
272 if (button_pressed_>=_SMU0 && button_pressed_<=_SMU3)
273 {
274 SMUselected_=button_pressed_;
275 DisplaySMULabel();
276 }
277 return button_pressed_;
278 }
279
280 void EasySMU_IOpanel::DisplaySMULabel()
281 {
282 if (enabled_== 0) return;
283 lcd.setTextColor((SMUselected_==_SMU0 ? ILI9341_GREEN : ILI9341_WHITE),ILI9341_BLUE);
284 lcd.setCursor(_SMU0_LEFT+_SMU_TEXT_LEFT, _SMU0_TOP+_SMU_TEXT_TOP);
285 lcd.print("CH0");
286 lcd.setTextColor((SMUselected_==_SMU1 ? ILI9341_GREEN : ILI9341_WHITE),ILI9341_BLUE);
287 lcd.setCursor(_SMU1_LEFT+_SMU_TEXT_LEFT, _SMU1_TOP+_SMU_TEXT_TOP);
288 lcd.print("CH1");
289 lcd.setTextColor((SMUselected_==_SMU2 ? ILI9341_GREEN : ILI9341_WHITE),ILI9341_BLUE);
290 lcd.setCursor(_SMU2_LEFT+_SMU_TEXT_LEFT, _SMU2_TOP+_SMU_TEXT_TOP);
291 lcd.print("CH2");
292 lcd.setTextColor((SMUselected_==_SMU3 ? ILI9341_GREEN : ILI9341_WHITE),ILI9341_BLUE);
293 lcd.setCursor(_SMU3_LEFT+_SMU_TEXT_LEFT, _SMU3_TOP+_SMU_TEXT_TOP);
294 lcd.print("CH3");
295 lcd.setTextColor(ILI9341_WHITE,ILI9341_BLUE);
296 }
297
298 void EasySMU_IOpanel::OverwriteOldString(uint16_t fg_color, uint16_t bg_color, char *old_string, const char *new_string)
299 {
300 //lcd.setCursor(x, y);
301 if (enabled_== 0) return;
302 uint16_t new_x, new_y;
303 for (int8_t i=0; (i < 16) && (old_string[i] != '\0') && (new_string[i] != '\0'); i++)
304 {
305
306 new_x=lcd.getCursorX();
307 new_y=lcd.getCursorY();
308
309 lcd.setTextColor(bg_color,bg_color);
310 lcd.print(old_string[i]);
311
312 lcd.setCursor(new_x, new_y);
313 lcd.setTextColor(fg_color,bg_color);
314 lcd.print(new_string[i]);
315 }
316 }
317
318 void EasySMU_IOpanel::DisplayVoltageSourceSetting(int16_t channel, float flt_old, float flt_new)
319 {
320
321 if (enabled_== 0) return;
322 switch (channel)
323 {
324 case _CH0:
325 lcd.setCursor(_SMU0_LEFT+_TEXT_LEFT, _SMU0_TOP+_TEXT_TOP);
326 break;
327 case _CH1:
328 lcd.setCursor(_SMU1_LEFT+_TEXT_LEFT, _SMU1_TOP+_TEXT_TOP);
329 break;
330 case _CH2:
331 lcd.setCursor(_SMU2_LEFT+_TEXT_LEFT, _SMU2_TOP+_TEXT_TOP);
332 break;
333 case _CH3:
334 lcd.setCursor(_SMU3_LEFT+_TEXT_LEFT, _SMU3_TOP+_TEXT_TOP);
335 break;
336 }
337
338 char str_old[16], str_new[16];
339 dtostrf(flt_old,8,4,str_old);
340 strcat(str_old,"V");
341 dtostrf(flt_new,8,4,str_new);
342 strcat(str_new,"V");
343 OverwriteOldString(ILI9341_WHITE,ILI9341_BLUE,str_old,str_new);
344
345
346 }
347
348 void EasySMU_IOpanel::DisplayMeasuredVoltage(int16_t channel, float flt_old, float flt_new)
349 {
350 if (enabled_== 0) return;
351
352 switch (channel)
353 {
354 case _CH0:
355 lcd.setCursor(_SMU0_LEFT+_TEXT_LEFT_MID, _SMU0_TOP+_TEXT_TOP);
356 break;
357 case _CH1:
358 lcd.setCursor(_SMU1_LEFT+_TEXT_LEFT_MID, _SMU1_TOP+_TEXT_TOP);
359 break;
360 case _CH2:
361 lcd.setCursor(_SMU2_LEFT+_TEXT_LEFT_MID, _SMU2_TOP+_TEXT_TOP);
362 break;
363 case _CH3:
364 lcd.setCursor(_SMU3_LEFT+_TEXT_LEFT_MID, _SMU3_TOP+_TEXT_TOP);
365 break;
366 }
367 char str_old[16], str_new[16];
368 dtostrf(flt_old,8,4,str_old);
369 strcat(str_old,"V");
370 dtostrf(flt_new,8,4,str_new);
371 strcat(str_new,"V");
372 OverwriteOldString(ILI9341_WHITE,ILI9341_BLUE,str_old,str_new);
373
374 }
375
376 void EasySMU_IOpanel::DisplayTemperatureOfIadc(int16_t channel, float flt_old, float flt_new)
377 {
378 if (enabled_== 0) return;
379 switch (channel)
380 {
381 case _CH0:
382 lcd.setCursor(_SMU0_LEFT+10, _SMU0_TOP+_SMU_TEXT_TOP);
383 break;
384 case _CH1:
385 lcd.setCursor(_SMU1_LEFT+10, _SMU1_TOP+_SMU_TEXT_TOP);
386 break;
387 case _CH2:
388 lcd.setCursor(_SMU2_LEFT+10, _SMU2_TOP+_SMU_TEXT_TOP);
389 break;
390 case _CH3:
391 lcd.setCursor(_SMU3_LEFT+10, _SMU3_TOP+_SMU_TEXT_TOP);
392 break;
393 }
394 char str_old[16], str_new[16];
395 dtostrf(flt_old,3,1,str_old);
396 strcat(str_old,"C");
397 dtostrf(flt_new,3,1,str_new);
398 strcat(str_new,"C");
399 OverwriteOldString(ILI9341_WHITE,ILI9341_BLUE,str_old,str_new);
400
401 }
402
403 void EasySMU_IOpanel::DisplayTemperatureOfVadc(int16_t channel, float flt_old, float flt_new)
404 {
405 if (enabled_== 0) return;
406 switch (channel)
407 {
408 case _CH0:
409 lcd.setCursor(_SMU0_RIGHT-40, _SMU0_TOP+_SMU_TEXT_TOP);
410 break;
411 case _CH1:
412 lcd.setCursor(_SMU1_RIGHT-40, _SMU1_TOP+_SMU_TEXT_TOP);
413 break;
414 case _CH2:
415 lcd.setCursor(_SMU2_RIGHT-40, _SMU2_TOP+_SMU_TEXT_TOP);
416 break;
417 case _CH3:
418 lcd.setCursor(_SMU3_RIGHT-40, _SMU3_TOP+_SMU_TEXT_TOP);
419 break;
420 }
421 char str_old[16], str_new[16];
422 dtostrf(flt_old,3,1,str_old);
423 strcat(str_old,"C");
424 dtostrf(flt_new,3,1,str_new);
425 strcat(str_new,"C");
426 OverwriteOldString(ILI9341_WHITE,ILI9341_BLUE,str_old,str_new);
427
428 }
429
430 void EasySMU_IOpanel::AddLeadingSign(char chrSign, char *string,int8_t strlen)
431 {
432 int8_t i;
433 for (i=0; (i<strlen) && (string[i+1]==' '); i++);
434 if (string[i]==' ')
435 {
436 string[i]=chrSign;
437 }
438 }
439
440 void EasySMU_IOpanel::DisplayCurrentSourceSetting(int16_t channel, float flt_old, float flt_new, int8_t source_both_sink)
441 {
442 if (enabled_== 0) return;
443 switch (channel)
444 {
445 case _CH0:
446 lcd.setCursor(_SMU0_LEFT+_TEXT_LEFT, _SMU0_TOP+_TEXT_TOP_MID);
447 break;
448 case _CH1:
449 lcd.setCursor(_SMU1_LEFT+_TEXT_LEFT, _SMU1_TOP+_TEXT_TOP_MID);
450 break;
451 case _CH2:
452 lcd.setCursor(_SMU2_LEFT+_TEXT_LEFT, _SMU2_TOP+_TEXT_TOP_MID);
453 break;
454 case _CH3:
455 lcd.setCursor(_SMU3_LEFT+_TEXT_LEFT, _SMU3_TOP+_TEXT_TOP_MID);
456 break;
457 }
458 char str_old[16], str_new[16];
459 dtostrf(flt_old*1000,7,3,str_old);
460 strcat(str_old,"mA");
461 AddLeadingSign('+',str_old,16);
462 dtostrf(flt_new*1000,7,3,str_new);
463 strcat(str_new,"mA");
464 if (source_both_sink==_SOURCE_ONLY)
465 {
466 AddLeadingSign('+',str_new,16);
467 }
468 else if (source_both_sink==_SINK_ONLY)
469 {
470 AddLeadingSign('-',str_new,16);
471 }
472 OverwriteOldString(ILI9341_WHITE,ILI9341_BLUE,str_old,str_new);
473 }
474
475 void EasySMU_IOpanel::DisplayMeasuredCurrent(int16_t channel, float flt_old, float flt_new)
476 {
477 if (enabled_== 0) return;
478 switch (channel)
479 {
480 case _CH0:
481 lcd.setCursor(_SMU0_LEFT+_TEXT_LEFT_MID, _SMU0_TOP+_TEXT_TOP_MID);
482 break;
483 case _CH1:
484 lcd.setCursor(_SMU1_LEFT+_TEXT_LEFT_MID, _SMU1_TOP+_TEXT_TOP_MID);
485 break;
486 case _CH2:
487 lcd.setCursor(_SMU2_LEFT+_TEXT_LEFT_MID, _SMU2_TOP+_TEXT_TOP_MID);
488 break;
489 case _CH3:
490 lcd.setCursor(_SMU3_LEFT+_TEXT_LEFT_MID, _SMU3_TOP+_TEXT_TOP_MID);
491 break;
492 }
493 char str_old[16], str_new[16];
494 dtostrf(flt_old*1000,7,3,str_old);
495 strcat(str_old,"mA");
496 dtostrf(flt_new*1000,7,3,str_new);
497 strcat(str_new,"mA");
498 OverwriteOldString(ILI9341_WHITE,ILI9341_BLUE,str_old,str_new);
499 }
500
EasySMU_IOpanel::DisplayTemperatureOfVadc
void DisplayTemperatureOfVadc(int16_t channel, float flt_old, float flt_new)
Draw the measured temperature from the voltage ADC. Presently, not used as it clutters up the screen...
Definition: EasySMU_IOpanel.cpp:403
_BUTTON_WIDTH
#define _BUTTON_WIDTH
Definition: EasySMU_IOpanel.h:156
TS_Point
Definition: Adafruit_FT6206.h:49
_VMINUSMINUS_LEFT
#define _VMINUSMINUS_LEFT
Definition: EasySMU_IOpanel.h:175
_IMINUS_BOTTOM
#define _IMINUS_BOTTOM
Definition: EasySMU_IOpanel.h:193
TS_Point::x
int16_t x
Definition: Adafruit_FT6206.h:58
_SINK_ONLY
#define _SINK_ONLY
Definition: EasySMU.h:113
_SMU1_RIGHT
#define _SMU1_RIGHT
Definition: EasySMU_IOpanel.h:143
_SMU2_BOTTOM
#define _SMU2_BOTTOM
Definition: EasySMU_IOpanel.h:149
_IPLUS
Definition: EasySMU_IOpanel.h:122
EasySMU_IOpanel::SMUselected_
int SMUselected_
stores which SMU channel is selected on the TFT display
Definition: EasySMU_IOpanel.h:266
Adafruit_GFX::height
int16_t height(void) const
Definition: Adafruit_GFX.cpp:1025
_IPLUSPLUS_BOTTOM
#define _IPLUSPLUS_BOTTOM
Definition: EasySMU_IOpanel.h:198
_SMU0_TOP
#define _SMU0_TOP
Definition: EasySMU_IOpanel.h:136
_IMINUS_TOP
#define _IMINUS_TOP
Definition: EasySMU_IOpanel.h:192
Adafruit_GFX::setFont
void setFont(const GFXfont *f=NULL)
Definition: Adafruit_GFX.cpp:783
_TEXT_TOP
#define _TEXT_TOP
Definition: EasySMU_IOpanel.h:208
Adafruit_GFX::fillRoundRect
void fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
Definition: Adafruit_GFX.cpp:319
Adafruit_GFX::getCursorY
int16_t getCursorY(void) const
Definition: Adafruit_GFX.cpp:720
_SMU2
Definition: EasySMU_IOpanel.h:122
_VPLUS_RIGHT
#define _VPLUS_RIGHT
Definition: EasySMU_IOpanel.h:162
Adafruit_GFX::setCursor
void setCursor(int16_t x, int16_t y)
Definition: Adafruit_GFX.cpp:709
_SMU2_LEFT
#define _SMU2_LEFT
Definition: EasySMU_IOpanel.h:147
_SMU3_LEFT
#define _SMU3_LEFT
Definition: EasySMU_IOpanel.h:152
EasySMU_IOpanel::DisplayMeasuredVoltage
void DisplayMeasuredVoltage(int16_t channel, float flt_old, float flt_new)
Draw the measured voltage for a single channel.
Definition: EasySMU_IOpanel.cpp:348
Adafruit_GFX::width
int16_t width(void) const
Definition: Adafruit_GFX.cpp:1020
Adafruit_ILI9341::begin
void begin(void)
Definition: Adafruit_ILI9341.cpp:219
_SMU_TEXT_LEFT
#define _SMU_TEXT_LEFT
Definition: EasySMU_IOpanel.h:207
channel
static uint8_t channel
LTC2305 Channel selection.
Definition: DC1444A.ino:127
_VPLUSPLUS_TOP
#define _VPLUSPLUS_TOP
Definition: EasySMU_IOpanel.h:170
EasySMU_IOpanel::CheckButton
int CheckButton()
check if a button is pressed
Definition: EasySMU_IOpanel.cpp:177
_IMINUS_LEFT
#define _IMINUS_LEFT
Definition: EasySMU_IOpanel.h:190
ILI9341_WHITE
#define ILI9341_WHITE
Definition: Adafruit_ILI9341.h:113
Anonymous_Pro6pt7b.h
_VMINUSMINUS
Definition: EasySMU_IOpanel.h:122
Point::x
int x
Definition: SeeedTouchScreen.h:11
Point
Definition: SeeedTouchScreen.h:8
EasySMU_IOpanel::start_button_pressed_
uint32_t start_button_pressed_
keep track of when the button was pressed to later calculate the duration it has been held ...
Definition: EasySMU_IOpanel.h:260
Adafruit_GFX::getCursorX
int16_t getCursorX(void) const
Definition: Adafruit_GFX.cpp:715
_VPLUS_TOP
#define _VPLUS_TOP
Definition: EasySMU_IOpanel.h:160
_VMINUS_LEFT
#define _VMINUS_LEFT
Definition: EasySMU_IOpanel.h:166
Anonymous_ProBold14pt7b.h
EasySMU_IOpanel::DisplayMeasuredCurrent
void DisplayMeasuredCurrent(int16_t channel, float flt_old, float flt_new)
Draw the measured current for a single channel.
Definition: EasySMU_IOpanel.cpp:475
_BUTTON_HEIGHT
#define _BUTTON_HEIGHT
Definition: EasySMU_IOpanel.h:157
_SMU3
Definition: EasySMU_IOpanel.h:122
_IMINUSMINUS
Definition: EasySMU_IOpanel.h:122
EasySMU_IOpanel::DisplaySMULabel
void DisplaySMULabel()
Draw the SMU labels. The selected channel will be green.
Definition: EasySMU_IOpanel.cpp:280
TS_Point::y
int16_t y
Definition: Adafruit_FT6206.h:58
_CH0
#define _CH0
Definition: EasySMU.h:72
_IMINUSMINUS_LEFT
#define _IMINUSMINUS_LEFT
Definition: EasySMU_IOpanel.h:186
_BUTTON_TEXT_PLUSPLUS_LEFT
#define _BUTTON_TEXT_PLUSPLUS_LEFT
Definition: EasySMU_IOpanel.h:205
_IPLUSPLUS_TOP
#define _IPLUSPLUS_TOP
Definition: EasySMU_IOpanel.h:195
Point::y
int y
Definition: SeeedTouchScreen.h:11
_IPLUSPLUS_LEFT
#define _IPLUSPLUS_LEFT
Definition: EasySMU_IOpanel.h:196
_SMU1_BOTTOM
#define _SMU1_BOTTOM
Definition: EasySMU_IOpanel.h:144
EasySMU_IOpanel::DisplayVoltageSourceSetting
void DisplayVoltageSourceSetting(int16_t channel, float flt_old, float flt_new)
Draw the voltage source setting for a single channel.
Definition: EasySMU_IOpanel.cpp:318
Adafruit_GFX.h
_IPLUSPLUS
Definition: EasySMU_IOpanel.h:122
_IPLUSPLUS_RIGHT
#define _IPLUSPLUS_RIGHT
Definition: EasySMU_IOpanel.h:197
_SMU_HEIGHT
#define _SMU_HEIGHT
Definition: EasySMU_IOpanel.h:134
_VMINUSMINUS_BOTTOM
#define _VMINUSMINUS_BOTTOM
Definition: EasySMU_IOpanel.h:178
_IMINUS
Definition: EasySMU_IOpanel.h:122
_SMU0_BOTTOM
#define _SMU0_BOTTOM
Definition: EasySMU_IOpanel.h:139
_SMU0
Definition: EasySMU_IOpanel.h:122
_SMU3_TOP
#define _SMU3_TOP
Definition: EasySMU_IOpanel.h:151
Adafruit_GFX::setTextColor
void setTextColor(uint16_t c)
Definition: Adafruit_GFX.cpp:730
_VMINUS
Definition: EasySMU_IOpanel.h:122
_IPLUS_BOTTOM
#define _IPLUS_BOTTOM
Definition: EasySMU_IOpanel.h:183
_TEXT_TOP_MID
#define _TEXT_TOP_MID
Definition: EasySMU_IOpanel.h:209
Adafruit_FT6206::begin
boolean begin(uint8_t thresh=FT6206_DEFAULT_THRESSHOLD)
Setups the HW.
Definition: Adafruit_FT6206.cpp:48
Adafruit_ILI9341::setRotation
void setRotation(uint8_t r)
Definition: Adafruit_ILI9341.cpp:613
_BUTTON_RADIUS
#define _BUTTON_RADIUS
Definition: EasySMU_IOpanel.h:158
EasySMU_IOpanel::DisplayTemperatureOfIadc
void DisplayTemperatureOfIadc(int16_t channel, float flt_old, float flt_new)
Draw the measured temperature from the current ADC. Presently, not used as it clutters up the screen...
Definition: EasySMU_IOpanel.cpp:376
_BUTTON_TEXT_TOP
#define _BUTTON_TEXT_TOP
Definition: EasySMU_IOpanel.h:204
_TEXT_LEFT_MID
#define _TEXT_LEFT_MID
Definition: EasySMU_IOpanel.h:201
EasySMU_IOpanel::touchp
Adafruit_FT6206 touchp
Definition: EasySMU_IOpanel.h:250
_VPLUS
Definition: EasySMU_IOpanel.h:122
_IPLUS_TOP
#define _IPLUS_TOP
Definition: EasySMU_IOpanel.h:180
EasySMU_IOpanel::enabled_
uint8_t enabled_
indicates if the TFT is enabled.
Definition: EasySMU_IOpanel.h:267
ILI9341_BLUE
#define ILI9341_BLUE
Definition: Adafruit_ILI9341.h:107
_IPLUS_LEFT
#define _IPLUS_LEFT
Definition: EasySMU_IOpanel.h:181
_CH1
#define _CH1
Definition: EasySMU.h:73
_IPLUS_RIGHT
#define _IPLUS_RIGHT
Definition: EasySMU_IOpanel.h:182
ILI9341_GREEN
#define ILI9341_GREEN
Definition: Adafruit_ILI9341.h:108
_VMINUS_RIGHT
#define _VMINUS_RIGHT
Definition: EasySMU_IOpanel.h:167
EasySMU_IOpanel::Init
void Init()
Initialize the IO panel, including drawing buttons, etc.
Definition: EasySMU_IOpanel.cpp:106
_VPLUSPLUS_RIGHT
#define _VPLUSPLUS_RIGHT
Definition: EasySMU_IOpanel.h:172
_SMU_TEXT_TOP
#define _SMU_TEXT_TOP
Definition: EasySMU_IOpanel.h:206
_VPLUS_LEFT
#define _VPLUS_LEFT
Definition: EasySMU_IOpanel.h:161
_SOURCE_ONLY
#define _SOURCE_ONLY
Definition: EasySMU.h:111
x
int32_t x
Definition: LTC2492_Thermocouple_Meter.ino:119
_SMU1_TOP
#define _SMU1_TOP
Definition: EasySMU_IOpanel.h:141
EasySMU_IOpanel::duration_button_pressed_
uint32_t duration_button_pressed_
stores a value corresponding to how long the button has been pressed
Definition: EasySMU_IOpanel.h:261
Adafruit_ILI9341::fillScreen
void fillScreen(uint16_t color)
Definition: Adafruit_ILI9341.cpp:552
_SMU1_LEFT
#define _SMU1_LEFT
Definition: EasySMU_IOpanel.h:142
_TEXT_LEFT
#define _TEXT_LEFT
Definition: EasySMU_IOpanel.h:200
Adafruit_FT6206::getPoint
TS_Point getPoint(void)
Definition: Adafruit_FT6206.cpp:184
_IMINUSMINUS_BOTTOM
#define _IMINUSMINUS_BOTTOM
Definition: EasySMU_IOpanel.h:188
_VPLUSPLUS_LEFT
#define _VPLUSPLUS_LEFT
Definition: EasySMU_IOpanel.h:171
_SMU1
Definition: EasySMU_IOpanel.h:122
_VMINUSMINUS_TOP
#define _VMINUSMINUS_TOP
Definition: EasySMU_IOpanel.h:177
_SMU2_RIGHT
#define _SMU2_RIGHT
Definition: EasySMU_IOpanel.h:148
EasySMU_IOpanel::button_pressed_
int button_pressed_
stores the value of the button pressed (from enum)
Definition: EasySMU_IOpanel.h:265
EasySMU_IOpanel::DisplayCurrentSourceSetting
void DisplayCurrentSourceSetting(int16_t channel, float flt_old, float flt_new, int8_t source_both_sink)
Draw the current source setting for a single channel.
Definition: EasySMU_IOpanel.cpp:440
_VMINUSMINUS_RIGHT
#define _VMINUSMINUS_RIGHT
Definition: EasySMU_IOpanel.h:176
_VPLUS_BOTTOM
#define _VPLUS_BOTTOM
Definition: EasySMU_IOpanel.h:163
i
static int i
Definition: DC2430A.ino:184
_VPLUSPLUS_BOTTOM
#define _VPLUSPLUS_BOTTOM
Definition: EasySMU_IOpanel.h:173
_VMINUS_BOTTOM
#define _VMINUS_BOTTOM
Definition: EasySMU_IOpanel.h:168
Adafruit_FT6206.h
_SMU2_TOP
#define _SMU2_TOP
Definition: EasySMU_IOpanel.h:146
_IMINUS_RIGHT
#define _IMINUS_RIGHT
Definition: EasySMU_IOpanel.h:191
_SMU0_RIGHT
#define _SMU0_RIGHT
Definition: EasySMU_IOpanel.h:138
Adafruit_ILI9341.h
_VMINUS_TOP
#define _VMINUS_TOP
Definition: EasySMU_IOpanel.h:165
_SMU3_BOTTOM
#define _SMU3_BOTTOM
Definition: EasySMU_IOpanel.h:154
_IMINUSMINUS_TOP
#define _IMINUSMINUS_TOP
Definition: EasySMU_IOpanel.h:185
EasySMU_IOpanel::lcd
Adafruit_ILI9341 lcd
Definition: EasySMU_IOpanel.h:247
_VPLUSPLUS
Definition: EasySMU_IOpanel.h:122
_CH2
#define _CH2
Definition: EasySMU.h:74
Adafruit_FT6206::touched
boolean touched(void)
Definition: Adafruit_FT6206.cpp:102
_BUTTON_TEXT_LEFT
#define _BUTTON_TEXT_LEFT
Definition: EasySMU_IOpanel.h:203
EasySMU_IOpanel.h
Header File for EasySMU_IOpanel Library That Enables Touchscreen Control of EasySMU.
_SMU3_RIGHT
#define _SMU3_RIGHT
Definition: EasySMU_IOpanel.h:153
_IMINUSMINUS_RIGHT
#define _IMINUSMINUS_RIGHT
Definition: EasySMU_IOpanel.h:187
_SMU0_LEFT
#define _SMU0_LEFT
Definition: EasySMU_IOpanel.h:137
_CH3
#define _CH3
Definition: EasySMU.h:75
_NONE
Definition: EasySMU_IOpanel.h:122
_SMU_WIDTH
#define _SMU_WIDTH
Definition: EasySMU_IOpanel.h:133