Struct capsules::adc::Adc [] [src]

pub struct Adc<'a, A: Adc + AdcHighSpeed + 'a> {
    adc: &'a A,
    channels: &'a [&'a <A as Adc>::Channel],
    active: Cell<bool>,
    mode: Cell<AdcMode>,
    app: MapCell<App>,
    channel: Cell<usize>,
    callback: Cell<Option<Callback>>,
    app_buf_offset: Cell<usize>,
    samples_remaining: Cell<usize>,
    samples_outstanding: Cell<usize>,
    next_samples_outstanding: Cell<usize>,
    using_app_buf1: Cell<bool>,
    adc_buf1: TakeCell<'static, [u16]>,
    adc_buf2: TakeCell<'static, [u16]>,
    adc_buf3: TakeCell<'static, [u16]>,
}

ADC application driver, used by applications to interact with ADC. Not currently virtualized, only one application can use it at a time.

Fields

Methods

impl<'a, A: Adc + AdcHighSpeed + 'a> Adc<'a, A>
[src]

Functions to create, initialize, and interact with the ADC

[src]

Create a new Adc application interface

adc - ADC driver to provide application access to channels - list of ADC channels usable by applications adc_buf1 - buffer used to hold ADC samples adc_buf2 - second buffer used when continuously sampling ADC

[src]

Initialize the ADC This can be called harmlessly if the ADC has already been initialized

[src]

Store a buffer we've regained ownership of and return a handle to it The handle can have map called on it in order to process the data in the buffer

buf - buffer to be stored

[src]

Find a buffer to give to the ADC to store samples in

closure - function to run on the found buffer

[src]

Collect a single analog sample on a channel

channel - index into channels array, which channel to sample

[src]

Collected repeated single analog samples on a channel

channel - index into channels array, which channel to sample frequency - number of samples per second to collect

[src]

Collect a buffer-full of analog samples Samples are collected into the first app buffer provided. The number of samples collected is equal to the size of the buffer "allowed"

channel - index into channels array, which channel to sample frequency - number of samples per second to collect

[src]

Collect analog samples continuously Fills one "allowed" application buffer at a time and then swaps to filling the second buffer. Callbacks occur when the in use "allowed" buffer fills

channel - index into channels array, which channel to sample frequency - number of samples per second to collect

[src]

Stops sampling the ADC Any active operation by the ADC is canceled. No additional callbacks will occur. Also retrieves buffers from the ADC (if any)

Trait Implementations

impl<'a, A: Adc + AdcHighSpeed + 'a> Client for Adc<'a, A>
[src]

Callbacks from the ADC driver

[src]

Single sample operation complete Collects the sample and provides a callback to the application

sample - analog sample value

impl<'a, A: Adc + AdcHighSpeed + 'a> HighSpeedClient for Adc<'a, A>
[src]

Callbacks from the High Speed ADC driver

[src]

Internal buffer has filled from a buffered sampling operation. Copies data over to application buffer, determines if more data is needed, and performs a callback to the application if ready. If continuously sampling, also swaps application buffers and continues sampling when neccessary. If only filling a single buffer, stops sampling operation when the application buffer is full.

buf - internal buffer filled with analog samples length - number of valid samples in the buffer, guaranteed to be less than or equal to buffer length

impl<'a, A: Adc + AdcHighSpeed + 'a> Driver for Adc<'a, A>
[src]

Implementations of application syscalls

[src]

Provides access to a buffer from the application to store data in or read data from

_appid - application identifier, unused allow_num - which allow call this is slice - representation of application memory to copy data into

[src]

Provides a callback which can be used to signal the application

subscribe_num - which subscribe call this is callback - callback object which can be scheduled to signal the application

[src]

Method for the application to command or query this driver

command_num - which command call this is data - value sent by the application, varying uses _appid - application identifier, unused