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

uint16_t mode#

The mode used by TAM processing.

If non-zero then TAM mode is active. This should be used to determine whether the calculator is in TAM mode:

if(tam.mode) {
  // the calculator is in TAM mode
}

bool_t 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.

tamState_t tam#

Instance of the internal state for 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.

Functions

void tamEnterMode(int16_t func)#

Enters TAM mode.

This initialises TAM entry for the given command and sets the tamBuffer to 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 indexOfItems index 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

  • EXIT and 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.

Returns:

operation code

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.