TAM#
Most operations use various registers and flags to determine their output. Some operations use additional input that must be entered by the user after selecting the operation. These use the transient alpha mode abbreviated to TAM. The processing of this input whilst in TAM mode and its subsequent evaluation is handled by the functions in this module, along with the relevant user interface elements.
State and functions#
State
-
struct tamState_t#
State for TAM mode.
Most of this state is internal and so not documented.
Public Members
-
tamMode_t mode#
The mode used by TAM processing.
If non-zero then TAM mode is active. This should not be used directly, but instead use ::tamIsActive to determine whether in TAM mode.
if(tamIsActive()) { // the calculator is in TAM mode }
-
bool alpha#
Whether input is a string rather than a number.
For example, a named variable. If the calculator is in alpha mode then additional details apply. See tamProcessInput for further details.
-
int16_t key#
Only used for KEYG and KEYX.
-
tamMode_t mode#
-
tamState_t tam#
-
char *tamBuffer#
Buffer for output of TAM current state.
After calling tamProcessInput this buffer is updated to the latest TAM state and should be redrawn to the relevant part of the screen.
Enums
-
enum tamMode_t#
Values:
-
enumerator tmValue#
-
enumerator tmValueChb#
-
enumerator tmRegister#
-
enumerator tmFlagR#
-
enumerator tmFlagW#
-
enumerator tmStoRcl#
-
enumerator tmMDim#
-
enumerator tmShuffle#
-
enumerator tmLabel#
-
enumerator tmSolve#
-
enumerator tmNewMenu#
-
enumerator tmKey#
-
enumerator tmIntegrate#
-
enumerator tmCmp#
-
enumerator tmValue#
Functions
-
void tamReset(void)#
Reset the TAM state.
-
static inline bool tamIsActive(void)#
Return whether the calculator is currently waiting for TAM input.
- Returns
true if currently in TAM
-
static inline bool tamIsWaitingKey(void)#
Return whether TAM is waiting for a key assignment.
- Returns
true if waiting for key assignment
-
void tamEnterMode(int16_t func)#
Enters TAM mode.
This initialises TAM entry for the given command and sets the
tamBufferto the appropriate text. In GUI mode the keyboard is set-up. Once this function has been called TAM mode can be left by input processed by tamProcessInput or by calling tamLeaveMode. If TAM is left the command that triggered TAM is implicitly cancelled (no further action is needed). For the command to be executed the input must be processed by tamProcessInput.This function should be called instead of the command that requires TAM input. The command that requires TAM should be passed as a parameter.
- Parameters
func – [in] the
indexOfItemsindex for the command that requires TAM mode
-
void tamLeaveMode(void)#
Leaves TAM mode.
TAM mode is closed and the pending operation is cancelled.
-
void tamProcessInput(uint16_t item)#
Processes input for the TAM buffer.
Almost all input is handled by this function. The exceptions are:
alpha input when in ‘alpha’ mode (tamState_t::alpha), where input of alpha characters must be put into the AIM buffer before calling this function with the input item
EXITand other external functions where TAM should be closed externally using tamLeaveMode
After calling this function the tamBuffer will be updated and it should be redrawn to the relevant part of the display.
- Parameters
item – [in] the ITM value to process
-
int16_t tamOperation(void)#
Returns actual function for current TAM.
TODO: this shouldn’t be public
- Returns
operation code
Variables
-
tamState_t tam
-
struct tamState_t
- #include <tam.h>
State for TAM mode.
Most of this state is internal and so not documented.
Public Members
-
tamMode_t mode
The mode used by TAM processing.
If non-zero then TAM mode is active. This should not be used directly, but instead use ::tamIsActive to determine whether in TAM mode.
if(tamIsActive()) { // the calculator is in TAM mode }
-
int16_t function#
-
bool alpha
Whether input is a string rather than a number.
For example, a named variable. If the calculator is in alpha mode then additional details apply. See tamProcessInput for further details.
-
int16_t currentOperation#
-
bool dot#
-
bool indirect#
-
int16_t digitsSoFar#
-
int16_t value#
-
int16_t min#
-
int16_t max#
-
int16_t key
Only used for KEYG and KEYX.
-
bool keyAlpha#
-
bool keyDot#
-
bool keyIndirect#
-
bool keyInputFinished#
-
tamMode_t mode
Example#
Supposing a user enters the following command: STO 01. Here is the sequence of events for
the TAM module.
The STO command is entered which is detected as requiring TAM
tamEnterMode(ITM_STO);
This updates the tamBuffer so it now contains the text STO __ and sets tam.mode to
be non-zero. The calculator returns to waiting for input. The 0 key is pressed.
tamProcessInput(ITM_0);
tamBuffer is updated to contain STO 0_ but TAM input is not complete so tam.mode is
still set and the store function has yet to be called. The calculator again returns to waiting
for input. The 1 key is pressed.
tamProcessInput(ITM_1);
This completes the necessary input so the function associated with ITM_STO (fnStore) is
called with the parameter value 1. TAM is now completed so tam.mode is now 0.