Type Alias AdcDedicatedComponentType

Source
pub type AdcDedicatedComponentType<A> = AdcDedicated<'static, A>;

Aliased Type§

struct AdcDedicatedComponentType<A> { /* private fields */ }

Implementations

Source§

impl<'a, A> AdcDedicated<'a, A>
where A: Adc<'a> + AdcHighSpeed<'a>,

Source

pub fn new( adc: &'a A, grant: Grant<App, UpcallCount<1>, AllowRoCount<0>, AllowRwCount<2>>, channels: &'a [<A as Adc<'a>>::Channel], adc_buf1: &'static mut [u16; 128], adc_buf2: &'static mut [u16; 128], adc_buf3: &'static mut [u16; 128], ) -> AdcDedicated<'a, A>

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

Trait Implementations

Source§

impl<'a, A> Client for AdcDedicated<'a, A>
where A: Adc<'a> + AdcHighSpeed<'a>,

Callbacks from the ADC driver

Source§

fn sample_ready(&self, sample: u16)

Single sample operation complete.

Collects the sample and provides a callback to the application.

  • sample - analog sample value
Source§

impl<'a, A> HighSpeedClient for AdcDedicated<'a, A>
where A: Adc<'a> + AdcHighSpeed<'a>,

Callbacks from the High Speed ADC driver

Source§

fn samples_ready(&self, buf: &'static mut [u16], length: usize)

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 necessary. 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
Source§

impl<'a, A> SyscallDriver for AdcDedicated<'a, A>
where A: Adc<'a> + AdcHighSpeed<'a>,

Implementations of application syscalls

Source§

fn command( &self, command_num: usize, channel: usize, frequency: usize, processid: ProcessId, ) -> CommandReturn

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
  • _processid - application identifier, unused
Source§

fn allocate_grant(&self, processid: ProcessId) -> Result<(), Error>

Request to allocate a capsule’s grant for a specific process. Read more
Source§

fn allow_userspace_readable( &self, app: ProcessId, which: usize, slice: ReadWriteProcessBuffer, ) -> Result<ReadWriteProcessBuffer, (ReadWriteProcessBuffer, ErrorCode)>

System call for a process to pass a buffer (a UserspaceReadableProcessBuffer) to the kernel that the kernel can either read or write. The kernel calls this method only after it checks that the entire buffer is within memory the process can both read and write. Read more