Electronic Load  1.0
Programmable Constant Current Sink
Functions | Variables
control.c File Reference

Provides an input field for numerical Values. More...

Include dependency graph for control.c:

Functions

CONTROL_RET EnterNumber (ctlEnterNumber_t *val, drawMode_t mode)
 Enter a Number via Keyboard and/or Encoder. More...
 
static void EnterNumberDraw (ctlEnterNumber_t *val, drawMode_t mode)
 Draws the Input Field. More...
 
void EnterNumberRestoreValue (ctlEnterNumber_t *val)
 Restores the old Value of the Input Field Purpose is to reset it to the original value when the user exits the control with cancel. More...
 
void EnterNumberSaveValue (ctlEnterNumber_t *val)
 Saves the Value of the Input Field Purpose is to reset it to the original value when the user exits the control with cancel. More...
 
void EnterNumberSetValue (ctlEnterNumber_t *ctl, double val)
 Sets the Value. More...
 

Variables

bool cursorOn
 True if the Cursor has to be displayed. More...
 
uint8_t cursorPos
 Actual position of the Cursor (0=Left) More...
 
static char saveval [CONTROL_ENTER_NUMBER_MAX_SIZE]
 

Detailed Description

Provides an input field for numerical Values.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Function Documentation

◆ EnterNumberDraw()

static void EnterNumberDraw ( ctlEnterNumber_t val,
drawMode_t  mode 
)
static

Draws the Input Field.

Parameters
valPointer to enterNumber-struct
modeDrawing mode.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnterNumberSaveValue()

void EnterNumberSaveValue ( ctlEnterNumber_t val)

Saves the Value of the Input Field Purpose is to reset it to the original value when the user exits the control with cancel.

This function must be called when the user enters the control.

Parameters
valPointer to enterNumber-struct

◆ EnterNumberRestoreValue()

void EnterNumberRestoreValue ( ctlEnterNumber_t val)

Restores the old Value of the Input Field Purpose is to reset it to the original value when the user exits the control with cancel.

This function must be called when the user exits the control with the cancel key.

Parameters
valPointer to enterNumber-struct
Here is the call graph for this function:

◆ EnterNumber()

CONTROL_RET EnterNumber ( ctlEnterNumber_t val,
drawMode_t  mode 
)

Enter a Number via Keyboard and/or Encoder.

Parameters
valPointer to input data structure
modeThe draw mode
Returns
see CONTROL_RET

The value-member must be set to a default value before calling this function. The value is a pattern consisting of digits and optionally a period. The length of the pattern is constant and the period cannot be moved. The period must not be the very first or last character! The user then may modify the value. If return is != CONTROL_ENTER the value should not be used since it may have been erroneously modified by the user.
If return is CONTROL_CHANGE you may process the change but should call the function again (with the same val) to allow the user to continue with his input.
To keep this function non-blocking it will return CONRTOL_NOTHING if no key- or encoder event is pending. Call it again as soon as you find time to until it returns CONTROL_ENTER or CONTROL_CANCEL. You can specify a change-callback function which is called every time the value is changed by the encoder.

Here is the call graph for this function:

◆ EnterNumberSetValue()

void EnterNumberSetValue ( ctlEnterNumber_t ctl,
double  val 
)

Sets the Value.

Parameters
ctlThe address of the EnterNumber struct
valThe desired Value

Variable Documentation

◆ cursorOn

bool cursorOn

True if the Cursor has to be displayed.

◆ cursorPos

uint8_t cursorPos

Actual position of the Cursor (0=Left)

◆ saveval

char saveval[CONTROL_ENTER_NUMBER_MAX_SIZE]
static