87 #ifndef Dan_Touch_IOpanel_h 88 #define Dan_Touch_IOpanel_h 94 #define ADAFRUIT_TFT_TOUCHSHIELD_1947 97 #ifdef ADAFRUIT_TFT_TOUCHSHIELD_1947 103 #endif // ADAFRUIT_TFT_TOUCHSHIELD_1947 105 #ifdef SEEEDSTUDIO_TFT_TOUCHSHIELD_V2 110 #define YP A2 // must be an analog pin, use "An" notation! 111 #define XM A1 // must be an analog pin, use "An" notation! 112 #define YM 14 // can be a digital pin, this is A0 113 #define XP 17 // can be a digital pin, this is A3 116 #endif // SEEEDSTUDIO_TFT_TOUCHSHIELD_V2 122 enum {
_SMU0=
_CH0,
_SMU1=
_CH1,
_SMU2=
_CH2,
_SMU3=
_CH3,
_VPLUS,
_VMINUS,
_VPLUSPLUS,
_VMINUSMINUS,
_IPLUS,
_IMINUS,
_IPLUSPLUS,
_IMINUSMINUS,
_NONE };
125 #define _LCD_WIDTH 320 127 #define _LCD_HEIGHT 240 133 #define _SMU_WIDTH (_LCD_WIDTH-3*_SMU_SPACE)/2 134 #define _SMU_HEIGHT ((_LCD_HEIGHT/4)-_SMU_SPACE) 136 #define _SMU0_TOP _SMU_SPACE 137 #define _SMU0_LEFT _SMU_SPACE 138 #define _SMU0_RIGHT (_SMU0_LEFT + _SMU_WIDTH) 139 #define _SMU0_BOTTOM (_SMU0_TOP + _SMU_HEIGHT) 141 #define _SMU1_TOP (_SMU0_BOTTOM +_SMU_SPACE) 142 #define _SMU1_LEFT _SMU0_LEFT 143 #define _SMU1_RIGHT _SMU0_RIGHT 144 #define _SMU1_BOTTOM (_SMU1_TOP + _SMU_HEIGHT) 146 #define _SMU2_TOP _SMU0_TOP 147 #define _SMU2_LEFT _SMU0_RIGHT+_SMU_SPACE 148 #define _SMU2_RIGHT _SMU2_LEFT + _SMU_WIDTH 149 #define _SMU2_BOTTOM _SMU0_BOTTOM 151 #define _SMU3_TOP _SMU1_TOP 152 #define _SMU3_LEFT _SMU2_LEFT 153 #define _SMU3_RIGHT _SMU2_RIGHT 154 #define _SMU3_BOTTOM _SMU1_BOTTOM 156 #define _BUTTON_WIDTH (_LCD_WIDTH-5*_SMU_SPACE)/4 157 #define _BUTTON_HEIGHT ((_LCD_HEIGHT-5*_SMU_SPACE)/4) 158 #define _BUTTON_RADIUS (_BUTTON_HEIGHT/12) 160 #define _VPLUS_TOP (_VPLUS_BOTTOM-_BUTTON_HEIGHT) 161 #define _VPLUS_LEFT _SMU_SPACE 162 #define _VPLUS_RIGHT (_VPLUS_LEFT+_BUTTON_WIDTH) 163 #define _VPLUS_BOTTOM (_VMINUS_TOP-_SMU_SPACE) 165 #define _VMINUS_TOP (_VMINUS_BOTTOM-_BUTTON_HEIGHT) 166 #define _VMINUS_LEFT _SMU_SPACE 167 #define _VMINUS_RIGHT (_VMINUS_LEFT+_BUTTON_WIDTH) 168 #define _VMINUS_BOTTOM (_LCD_HEIGHT-_SMU_SPACE) 170 #define _VPLUSPLUS_TOP _VPLUS_TOP 171 #define _VPLUSPLUS_LEFT (_VPLUS_RIGHT+_SMU_SPACE) 172 #define _VPLUSPLUS_RIGHT _SMU1_RIGHT 173 #define _VPLUSPLUS_BOTTOM _VPLUS_BOTTOM 175 #define _VMINUSMINUS_LEFT _VPLUSPLUS_LEFT 176 #define _VMINUSMINUS_RIGHT _VPLUSPLUS_RIGHT 177 #define _VMINUSMINUS_TOP _VMINUS_TOP 178 #define _VMINUSMINUS_BOTTOM _VMINUS_BOTTOM 180 #define _IPLUS_TOP _VPLUS_TOP 181 #define _IPLUS_LEFT _SMU3_LEFT 182 #define _IPLUS_RIGHT (_IPLUS_LEFT+_BUTTON_WIDTH) 183 #define _IPLUS_BOTTOM _VPLUS_BOTTOM 185 #define _IMINUSMINUS_TOP _IMINUS_TOP 186 #define _IMINUSMINUS_LEFT _IPLUSPLUS_LEFT 187 #define _IMINUSMINUS_RIGHT _IPLUSPLUS_RIGHT 188 #define _IMINUSMINUS_BOTTOM _IMINUS_BOTTOM 190 #define _IMINUS_LEFT _IPLUS_LEFT 191 #define _IMINUS_RIGHT _IPLUS_RIGHT 192 #define _IMINUS_TOP _VMINUS_TOP 193 #define _IMINUS_BOTTOM _VMINUS_BOTTOM 195 #define _IPLUSPLUS_TOP _VPLUSPLUS_TOP 196 #define _IPLUSPLUS_LEFT (_IPLUS_RIGHT + _SMU_SPACE) 197 #define _IPLUSPLUS_RIGHT _SMU3_RIGHT 198 #define _IPLUSPLUS_BOTTOM _VPLUSPLUS_BOTTOM 201 #define _TEXT_LEFT_MID 75 202 #define _BUTTON_TEXT_TOP 35 203 #define _BUTTON_TEXT_LEFT 25 204 #define _BUTTON_TEXT_TOP 35 205 #define _BUTTON_TEXT_PLUSPLUS_LEFT 15 206 #define _SMU_TEXT_TOP 15 207 #define _SMU_TEXT_LEFT 65 209 #define _TEXT_TOP_MID 48 224 uint16_t text_width_;
225 uint16_t text_height_;
226 int16_t text_x_offset_;
227 int16_t text_y_offset_;
229 void DrawText( int16_t
x,
235 void OverwriteOldString(uint16_t fg_color,
238 const char *new_string
241 void AddLeadingSign(
char chrSign,
249 #ifdef ADAFRUIT_TFT_TOUCHSHIELD_1947 251 #endif // ADAFRUIT_TFT_TOUCHSHIELD_1947 253 #ifdef SEEEDSTUDIO_TFT_TOUCHSHIELD_V2 255 #endif // SEEEDSTUDIO_TFT_TOUCHSHIELD_V2 285 int8_t source_both_sink
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...
int SMUselected_
stores which SMU channel is selected on the TFT display
void DisplayMeasuredVoltage(int16_t channel, float flt_old, float flt_new)
Draw the measured voltage for a single channel.
static uint8_t channel
LTC2305 Channel selection.
int CheckButton()
check if a button is pressed
uint32_t start_button_pressed_
keep track of when the button was pressed to later calculate the duration it has been held ...
void DisplayMeasuredCurrent(int16_t channel, float flt_old, float flt_new)
Draw the measured current for a single channel.
Class Library Header File for EasySMU: I2C Address Translator Demonstration and a Simple Multi-Channe...
void DisplaySMULabel()
Draw the SMU labels. The selected channel will be green.
The EasySMU_IOpanel class provides an interface between the EasySMU and a touchscreen.
void DisplayVoltageSourceSetting(int16_t channel, float flt_old, float flt_new)
Draw the voltage source setting for a single channel.
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...
uint8_t enabled_
indicates if the TFT is enabled.
void Init()
Initialize the IO panel, including drawing buttons, etc.
uint32_t duration_button_pressed_
stores a value corresponding to how long the button has been pressed
int button_pressed_
stores the value of the button pressed (from enum)
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.
#define YP
NOT FOR USE WITH THE TOUCH SHIELD, ONLY FOR THE BREAKOUT!