# TPRecvCallback

## Definition

  `#include <nitro/spi.h>`

      typedef void (*TPRecvCallback)(
              TPRequestCommand command,
              TPRequestResult result,
              u16 index );

## Arguments

command | Type of request command
result | Processing results
index | Index value of autosampling callback

## Return Values

None.

## Description

This is the format of the the user callback that is called each time a request to the ARM7 is processed, and each time that a touch panel value is periodically received as the result of autosampling. The command value identifies for which request the results are acquired. The result value acquires whether or not it was processed properly. The index value acquires the index of the most recent data when autosampling is in use.

`TP_REQUEST_COMMAND_SAMPLING` | Requests one round of sampling. Sent with a `TP_RequestSampling*` function.
`TP_REQUEST_COMMAND_AUTO_ON` | Requests to start autosampling. Sent with the `TP_RequestAutoSamplingStart` function.
`TP_REQUEST_COMMAND_AUTO_OFF` | Requests to stop autosampling. Sent with the `TP_RequestAutoSamplingStop` function.
`TP_REQUEST_COMMAND_SET_STABILITY` | Requests to set the chattering parameter. Sent with the `TP_RequestSetStability` function.
`TP_REQUEST_COMMAND_AUTO_SAMPLING` | This callback is called each time data is set by autosampling.

`TP_RESULT_SUCCESS` | Successful end
`TP_RESULT_INVALID_PARAMETER` | Parameters in the request that was sent are incorrect.
`TP_RESULT_ILLEGAL_STATUS` | Cannot process this instruction in current status.
`TP_RESULT_EXCLUSIVE` | ARM7 processor's peripheral device interface is in busy status.
`TP_RESULT_PXI_BUSY` | Request failed because communication between CPUs is busy

The following describes the enumerated type definitions of the arguments.

    // Type of instruction issued to the touch panel
    typedef enum {
        TP_REQUEST_COMMAND_SAMPLING         = 0x0,  // Sample one time
        TP_REQUEST_COMMAND_AUTO_ON          = 0x1,  // Start autosampling
        TP_REQUEST_COMMAND_AUTO_OFF         = 0x2,  // Stop autosampling
        TP_REQUEST_COMMAND_SETUP_STABILITY  = 0x3,  // Set chattering provision value
        TP_REQUEST_COMMAND_AUTO_SAMPLING    = 0x10 // Receive autosampling results
    } TPRequestCommand;

    // Type of results from the touch panel
    typedef enum {
        TP_RESULT_SUCCESS = 0 ,             // Success
        TP_RESULT_INVALID_PARAMETER ,       // Invalid parameter
        TP_RESULT_ILLEGAL_STATUS ,          // In current status cannot receive instructions
        TP_RESULT_EXCLUSIVE ,               // SPI device is busy
        TP_RESULT_PXI_BUSY                  // The PXI communication with ARM7 is busy
    } TPRequestResult;

## See Also

`TP_SetCallback`
`TP_RequestSampling`
`TP_RequestAutoSamplingStart`
`TP_RequestAutoSamplingStop`
`TP_RequestSetStability`

## Revision History

2004/04/16 Initial version.

CONFIDENTIAL