Struct sam4l::adc::Adc [] [src]

pub struct Adc {
    registers: *mut AdcRegisters,
    enabled: Cell<bool>,
    adc_clk_freq: Cell<u32>,
    active: Cell<bool>,
    continuous: Cell<bool>,
    dma_running: Cell<bool>,
    cpu_clock: Cell<bool>,
    timer_repeats: Cell<u8>,
    timer_counts: Cell<u8>,
    rx_dma: Cell<Option<&'static DMAChannel>>,
    rx_dma_peripheral: DMAPeripheral,
    rx_length: Cell<usize>,
    next_dma_buffer: TakeCell<'static, [u16]>,
    next_dma_length: Cell<usize>,
    stopped_buffer: TakeCell<'static, [u16]>,
    client: Cell<Option<&'static EverythingClient>>,
}

ADC driver code for the SAM4L.

Fields

Methods

impl Adc
[src]

Functions for initializing the ADC.

[src]

Create a new ADC driver.

  • base_address: pointer to the ADC's memory mapped I/O registers
  • rx_dma_peripheral: type used for DMA transactions

[src]

Sets the client for this driver.

  • client: reference to capsule which handles responses

[src]

Sets the DMA channel for this driver.

  • rx_dma: reference to the DMA channel the ADC should use

[src]

Interrupt handler for the ADC.

[src]

Trait Implementations

impl Adc for Adc
[src]

Implements an ADC capable reading ADC samples on any channel.

The chip-dependent type of an ADC channel.

[src]

Enable and configure the ADC. This can be called multiple times with no side effects.

[src]

Capture a single analog sample, calling the client when complete. Returns an error if the ADC is already sampling.

  • channel: the ADC channel to sample

[src]

Request repeated analog samples on a particular channel, calling after each sample. In order to not unacceptably slow down the system collecting samples, this interface is limited to one sample every 100 microseconds (10000 samples per second). To sample faster, use the sample_highspeed function.

  • channel: the ADC channel to sample
  • frequency: the number of samples per second to collect

[src]

Stop continuously sampling the ADC. This is expected to be called to stop continuous sampling operations, but can be called to abort any currently running operation. The buffer, if any, will be returned via the samples_ready callback.

impl AdcHighSpeed for Adc
[src]

Implements an ADC capable of continuous sampling

[src]

Capture buffered samples from the ADC continuously at a given frequency, calling the client whenever a buffer fills up. The client is then expected to either stop sampling or provide an additional buffer to sample into. Note that due to hardware constraints the maximum frequency range of the ADC is from 187 kHz to 23 Hz (although its precision is limited at higher frequencies due to aliasing).

  • channel: the ADC channel to sample
  • frequency: frequency to sample at
  • buffer1: first buffer to fill with samples
  • length1: number of samples to collect (up to buffer length)
  • buffer2: second buffer to fill once the first is full
  • length2: number of samples to collect (up to buffer length)

[src]

Provide a new buffer to send on-going buffered continuous samples to. This is expected to be called after the samples_ready callback.

  • buf: buffer to fill with samples
  • length: number of samples to collect (up to buffer length)

[src]

Reclaim buffers after the ADC is stopped. This is expected to be called after stop_sampling.

impl DMAClient for Adc
[src]

Implements a client of a DMA.

[src]

Handler for DMA transfer completion.

  • pid: the DMA peripheral that is complete