# TP_RequestAutoSamplingStart

## C Specification

  `#include <nitro/spi.h>`

      u32 TP_RequestAutoSamplingStart(
      u16 vcount,
      u16 frequence,
      TPData samplingBufs[],
      u16 bufSize );

## Arguments

vcount | Base Vcount value for auto sampling
frequence | The number of samples taken during one frame. (MAX 4)
samplingBufs | The pointer that sets the buffer in which auto sampling values are stored.
bufSize | The size of the buffer that was passed by samplingBufs

## Return Values

Returns 0 if the request succeeds.
Returns non-zero value if it fails.

## Description

This function issues a request to ARM7 to begin auto sampling touch panel values and waits for the request to complete internally. This is the synchronous version of `TP_RequestAutoSamplingStartAsync`. After this request is accepted, sampling is carried out periodically and values are stored in the array specified by `samplingBufs`. The autosampling interval is the uniform interval that data (as set in the `frequence` argument) is sampled by VAlarm in one frame based on the value set in `vcount`. If a user callback is set with `TP_SetCallback`, notice is given by a callback each time a value is saved. After this function clears `samplingBufs`, the buffer will be used as a loop buffer. To acquire the index of the last stored data, use `TP_GetLatestIndexInAuto`. When auto-sampling, it is possible that the sampling value for (newest index + 1) will be unexpectedly overwritten by an interrupt. If you are using the sampling values from one frame all together, you can avoid this by securing an area that is at least `frequence` + 1.

## Caution

This function uses an interrupt to wait for a completion response from ARM7. Notice that if it is called while FIFO receive interrupts from ARM7 are prohibited, it will not be possible to return from wait.

## See Also

`TP_RequestAutoSamplingStop`, `TP_GetLatestRawPointInAuto`, `TP_GetLatestCalibratedPointInAuto`, `TP_GetLatestIndexInAuto`, `TP_RequestAutoSamplingStartAsync`

## Revision History

04/21/2004 Made asynchronous version and made it synchronous
04/16/2004 Initial version

CONFIDENTIAL