# MICSamplingType

## Definition

  `#include <nitro/spi.h>`

      typedef enum
      {
          MIC_SAMPLING_TYPE_8BIT = 0 ,
          MIC_SAMPLING_TYPE_12BIT ,
          MIC_SAMPLING_TYPE_SIGNED_8BIT ,
          MIC_SAMPLING_TYPE_SIGNED_12BIT ,
          MIC_SAMPLING_TYPE_12BIT_FILTER_OFF ,
          MIC_SAMPLING_TYPE_SIGNED_12BIT_FILTER_OFF ,
          MIC_SAMPLING_TYPE_MAX

      } MICSamplingType;

## Elements

MIC_SAMPLING_TYPE_8BIT | Sampling with a valid bit width of 8 bits (unsigned). The range of output data is 0 to 255.
MIC_SAMPLING_TYPE_12BIT | Sampling with a valid bit width of 12 bits (unsigned). The range of output data is 0 to 65520.
MIC_SAMPLING_TYPE_SIGNED_8BIT | Sampling with a valid bit width of 8 bits (signed). The range of output data is -128 to 127.
MIC_SAMPLING_TYPE_SIGNED_12BIT | Sampling with a valid bit width of 12 bits (signed). The range of output data is -32768 to 32752.
MIC_SAMPLING_TYPE_12BIT_FILTER_OFF | Sampling with a valid bit width of 12 bits (unsigned) with no filter. The range of output data is `0` to `65520`. If there was a conflict with another SPI device access and sampling failed, the output data becomes `0xffff` (`65535`).
MIC_SAMPLING_TYPE_SIGNED_12BIT_FILTER_OFF | Sampling with a valid bit width of 12 bits (signed) with no filter. The range of output data is `-32768` to `32752`. If there was a conflict with another SPI device access and sampling failed, the output data becomes `0xffff` (`-1`).

## Description

List of the sampling types. Sampling can be conducted with one of two levels of resolution: 8 bits or 12 bits. Data can be output in the format regardless of whether it is signed or unsigned. With 8-bit sampling, 1 byte of data is obtained each time. With 12-bit sampling, 2 bytes of data are obtained each time (the upper 12 bits are valid, the lower 4 bits are zero-padded).
When the input sound exceeds the valid bit width, the output data is clamped to the minimum or the maximum value. The volume that can be covered with the valid bit width can be changed using a `PM_SetAmpGain*` function.
When performing auto-sampling, sampling may fail if there is a conflict with another SPI device (such as touch panel). When this occurs, it is normally filtered by using the sampling data that is immediately before it. However, if `*_FILTER_OFF` was specified as the sampling type, filtering will not occur and the value that indicates a sampling failure (`0xffff`) will be output.

## See Also

`MIC_DoSampling, MIC_DoSamplingAsync, MIC_StartAutoSampling, MIC_StartAutoSamplingAsync, PM_SetAmpGain, MIC_StartLimitedSampling, MIC_StartLimitedSamplingAsync`

## Revision History

2004/12/03 Added a sampling type without a filter
2004/06/01 Initial version

CONFIDENTIAL